Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
155
rated 0 times [  160] [ 5]  / answers: 1 / hits: 21954  / 9 Years ago, thu, january 21, 2016, 12:00:00

In react-native we use styleSheet.create. What do we use in reactjs?



Thanks for the help!



https://github.com/romseguy/redux-store-visualizer



I dont see any use of style here but there is styling. how did he achieve this or did i miss out anything?


More From » reactjs

 Answers
123

The analogous option would be to do something like the following:



let styles = {
container: {
backgroundColor: 'red'
}
}


Like one of the comments stated above, the StyleSheet call is unecessary because CSS is supported already on the browser.



Finally, just call the style inline in your render function's return statement:



render() {
...
return (
<div style={styles.container} />
)
}


Of course, aside from that, you have a few other options as well, like using plain CSS stylesheets and classes/tags, but this is probably the most similar option to what you're used to.


[#63628] Tuesday, January 19, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckenna

Total Points: 445
Total Questions: 109
Total Answers: 109

Location: Virgin Islands (U.S.)
Member since Sun, May 16, 2021
3 Years ago
;