You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi,
reading this article https://reactjsnews.com/how-to-make-your-react-apps-10x-faster i have see that react can process object literals for template.
This have some performance,beacuse instead of calling createElement we can simple return the object literal created from createElement at compile time when the macro jsx works.
we could add a flag like -D react-fast-jsx to make retrun object literals from jsx macro instead of React.createElement
Also babel has introduce this new features
`
Babel 5.8.24 introduces Inlining React elements: The optimisation.react.inlineElements transform converts JSX elements to object literals like {type: 'div', props: ...} instead of calls to React.createElement . This should only be enabled in production, since it disables some development warnings/checks.
•Babel 5.8.24 introduces Constant hoisting for React elements: The optimisation.react.constantElements transform hoists element creation to the top level for subtrees that are fully static, which reduces calls to React.createElement and the resulting allocations. More importantly, it tells React that the subtree hasn’t changed so React can completely skip it when reconciling. This should only be enabled in production, since it disables some development warnings/checks.
`
The text was updated successfully, but these errors were encountered:
It seems object literals could be done reasonably simply: facebook/react#3228
Constants hoisting is much more difficult to apply.
Another possibility offered by Haxe type system: spreads could be resolved as properties instead of having React inspect objects at run time.
Optimizations besides object literals should be moved into separate tickets.
hi,
reading this article https://reactjsnews.com/how-to-make-your-react-apps-10x-faster i have see that react can process object literals for template.
This have some performance,beacuse instead of calling createElement we can simple return the object literal created from createElement at compile time when the macro jsx works.
we could add a flag like -D react-fast-jsx to make retrun object literals from jsx macro instead of React.createElement
Also babel has introduce this new features
`
Babel 5.8.24 introduces Inlining React elements: The optimisation.react.inlineElements transform converts JSX elements to object literals like {type: 'div', props: ...} instead of calls to React.createElement . This should only be enabled in production, since it disables some development warnings/checks.
•Babel 5.8.24 introduces Constant hoisting for React elements: The optimisation.react.constantElements transform hoists element creation to the top level for subtrees that are fully static, which reduces calls to React.createElement and the resulting allocations. More importantly, it tells React that the subtree hasn’t changed so React can completely skip it when reconciling. This should only be enabled in production, since it disables some development warnings/checks.
`
The text was updated successfully, but these errors were encountered: