In React-native We Use StyleSheet.create. What Do We Use In Reactjs?

- 1 answer

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

Thanks for the help!

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



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.