FormidableLabs / rapscallion

Asynchronous React VirtualDOM renderer for SSR.
MIT License
1.39k stars 50 forks source link

babel-plugin-server Transform Valueless Props #117

Closed 88kami88 closed 6 years ago

88kami88 commented 7 years ago

Fixes #73

babel-types/ObjectProperty expects a babel-types null literal or empty JSX expression when the value of an attribute is not given.

If the attribute value is null, use .nullLiteral(). If the attribute value is undefined, use jSXEmptyExpression.

There are no tests for babel-plugin-server that I can find.


The maintainers of this repo require that all pull request submitters adhere to the following:

The maintainers of this repository require you to select the semantic version type that the changes in this pull request represent. Please select one of the following:

shuhei commented 7 years ago

A prop value is true by default. https://facebook.github.io/react/docs/jsx-in-depth.html

Does this implementation work like that?

88kami88 commented 7 years ago

So this is a babel plugin that transforms a createElement call into an object representation of an element. React will still handle turning the valueless prop into a true value.

There might be performance gains to be had by transforming no value into true though, I'll have to look into it.

88kami88 commented 7 years ago

@divmain I'm not sure how to rectify this error. I committed an empty line:

msg — Commit message for 7c9ef24 must have empty second line. Required