Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Optimize "if-else" children #58

Merged
merged 6 commits into from
Jun 7, 2016
Merged

Optimize "if-else" children #58

merged 6 commits into from
Jun 7, 2016

Conversation

jridgewell
Copy link
Owner

@jridgewell jridgewell commented Jun 4, 2016

In JSX, since there’s not if-else statements, most people use condition ? <div /> : <other /> or condition && <div /> || <other /> to conditionally render children.

This optimizes them so they do not require a JSX wrapper.

Fixes #57.

jridgewell and others added 6 commits June 4, 2016 05:06
No longer present in Babel 6
In JSX, since there’s not if-else statements, most people use
`condition ? <div /> : <other />` or `condition && <div /> || <other
/>` to conditional render children. This optimizes them so they do not
require a JSX wrapper.

Fixes #57.
Anything that gets a reference to a JSX element will deoptimize into a
wrapper
So a JSX element in the last position means we don’t need to
arbitrarily render.
@jridgewell jridgewell merged commit 803a940 into master Jun 7, 2016
@jridgewell jridgewell deleted the if-then-children branch June 7, 2016 19:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant