We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Looks like the implementation of TunnelPlaceholder is treating render props as if they were full fledged components by using React.creatElement.
TunnelPlaceholder
React.creatElement
While this is cool because it let you expose a double API:
<TunnelPlaceholder> {props => <MyComponent {...props} />} </TunnelPlaceholder> // is equal to <TunnelPlaceholder> {MyComponent} </TunnelPlaceholder>
But this has a major caveat: when using the render-prop API every re-render will unmount and remount the whole placeholder children!
This is because between different render phases React thinks this is a completely new component and that it cannot reconciliate in any way.
What you actually want to achieve (probably) is something along the lines of what react-router does by exposing three different props:
react-router
render
children
component
And you can have a look at how they implement their #render method too.
#render
I’ll make a PR soon so that if you are ok with the approach you can accept it right away.
The text was updated successfully, but these errors were encountered:
Whooops! There’s a PR exactly for this! See #6
Sorry, something went wrong.
No branches or pull requests
Looks like the implementation of
TunnelPlaceholder
is treating render props as if they were full fledged components by usingReact.creatElement
.While this is cool because it let you expose a double API:
But this has a major caveat: when using the render-prop API every re-render will unmount and remount the whole placeholder children!
This is because between different render phases React thinks this is a completely new component and that it cannot reconciliate in any way.
What you actually want to achieve (probably) is something along the lines of what
react-router
does by exposing three different props:render
which is a render prop,children
which is a render prop,component
which is treated as a ComponentType or a Functional Stateless Component.And you can have a look at how they implement their
#render
method too.I’ll make a PR soon so that if you are ok with the approach you can accept it right away.
The text was updated successfully, but these errors were encountered: