-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
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
React component unmount #31
Comments
@whitecolor Thank you for the issue. I think you are definitely correct here. I'm not very familiar with React myself. Do you believe something like: export const reactComponent = (Klass, attrs, hookname = 'update') =>
div({
hook: {
[hookname]: ({elm}) => ReactDOM.render(<Klass {...attrs} />, elm),
+ destroy: ({elm}) => ReactDOM.unmountComponentAtNode(elm)
}
}) Would be enough to ensure all of the React specfics are being handled? |
I think yes, it should work this way. Snabdom seems to have very good api for that, if it works fine for any kind of elements without perfomance penalty it is great.
is |
I would definitely say yes, it shares every single test that @cycle/dom does (minus one regarding virtual-dom widgets), and then some more that are specific to snabbdom. |
@whitecolor thank you for the suggestion! I'm wondering if it might be worth it to extract this into a simple snabbdom-react-component package? |
I think no reason to extract it to package yet, it probably doesn't cover all the use cases. |
https://github.com/sdebaun/sparks-cyclejs/blob/release/src/helpers/dom/index.js#L11
I think just using hook is not enogth for correct component unmount. I mean that when element removed from DOM
unmount
lifecycle methods on React component will not be called automatically.The text was updated successfully, but these errors were encountered: