jonalv
jonalv

Reputation: 6116

Right aligning table cell when using React

I am trying to right align the content of a table cell, similar to what is explained here:

<td style="text-align:right">

However, it seems React has decided that the style keyword should not be used like that:

Line XX:  Style prop value must be an object   react/style-prop-object

An answer on this site indicated that "styles" should be used instead:

<td styles="text-align:right">

Of course React thinks that is fine but it is not like my web browser knows that when I say styles I in fact mean style. How can I right align the contents in my table?

Upvotes: 2

Views: 5892

Answers (2)

user10288069
user10288069

Reputation:

In your table tag,


<table class="text-center"> </table>

Upvotes: 0

Alex Antonov
Alex Antonov

Reputation: 15146

Correct usage is

<td style={{ textAlign: 'right' }}>

Reference

Upvotes: 4

Related Questions