Let's say that I have a component in react like this...
<h1>Hello World</h1>
...to style it, I can use an inline notation...
<h1 style={{ fontSize: 32, color: 'dodgerblue' }}>Hello World</h1>
...or I can encapsulate the styles inside an object like this...
const style = {
fontSize: 32,
color: 'dodgerblue'
}
<h1 style={style}>Hello World</h1>
...the problem with the second approach is that I am longer getting IntelliSense or proper error-handling for the stylesheet. In react-native, we can do something like this...
const style = Stylesheet.create({
...
})
...I hope I've explained it enough, so can we do something similar in React?