1 min readMar 26, 2019
Ow, I mean, we need both, we initialize it inside the constructor and mutate the values inside the render, this will avoid of concurrent requests and keep it more simple to work with.
Something like:
class Button extends React.Component {
state = {
color: "#000000;"
};
render() {
const { color } = this.state;
return (
<button className={color}>
{this.props.children}
</button>
);
}
}Please, let me know if you have a better approach.