pugjs / babel-plugin-transform-react-pug

A plugin for transpiling pug templates to jsx
MIT License
808 stars 46 forks source link

className #57

Closed wh-Coder closed 6 years ago

wh-Coder commented 6 years ago

Know from the documentation:

React.Fragment becomes \<React className="Fragment" />

but in RN Use braces instead of quotes:

\<React className={Fragment} /> or \<React className={[Fragment1, Fragment2]}/>

ezhlobo commented 6 years ago

@wh-Coder that's tricky, because ideally we need to convert React.Fragment into <React.Fragment />. Not to <React className="Fragment" /> or <React className={Fragment} />.

To set class names for RN you can define classes as you do with JSX:

View(class=styles.wrapper)
  Text(class=styles.text)

If I misunderstood your concern, could you give more details?

ForbesLindesay commented 6 years ago

This isn't a react vs. react native thing. The syntax is exactly the same for React vs. React Native. <Foo bar="value" /> is a shorthand for <Foo bar={'value'} /> and is supported on all React platforms. It just means that it's the literal string, not the value of a variable.