Search code examples
reactjsreact-dom

Inline style table row w/ React


I have this method returning table rows, I am trying to add a background color to each row

 collateRedditResuls() {
        return this.state.items.map(function (item, index) {


            return (
                <tr style={{'bgcolor':'#ffa500'}} key={ uuid()}>
                    <td>{item.title}</td>
                    <td> {item.description}</td>
                    <td><img src={item.image}/></td>
                </tr>
            )
        });
    }

for some reason this technique does not work, the table background is still uncolored - anybody know why?


Solution

  • You need to type out the full CSS property name:

    {{ 'backgroundColor': '#ffa500' }}