Thank you for stopping by! I am a full-stack developer that combines the power of entrepreneurship and programming to make the lives of programmers easier.
I'm not too familiar with JSX and React so I don't understand why do you create an object to represent the style instead of using it inline. From this:
Hi @codevault
, the traditional approach of defining styles is simply not supported in JSX. The official reason is: this is consistent with the DOM style JavaScript property, is more efficient, and prevents XSS security holes.
So the external pair of curly braces is to indicate this is going to be read from a JSX variable, and the internal pair of curly braces is because it's a JS object.
I'm not too familiar with JSX and React so I don't understand why do you create an object to represent the style instead of using it inline. From this:
to this:
Does react or JSX do something special when it sees the style param like that?
Hi @codevault , the traditional approach of defining styles is simply not supported in JSX. The official reason is: this is consistent with the DOM style JavaScript property, is more efficient, and prevents XSS security holes.
So the external pair of curly braces is to indicate this is going to be read from a JSX variable, and the internal pair of curly braces is because it's a JS object.
Source: reactjs.org/docs/dom-elements.html...