-
Notifications
You must be signed in to change notification settings - Fork 48.6k
RFC: React forceRemount #3899
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
Comments
Not sure what your proposed API is? Can you unmount and then remount? |
@spicyj Think |
This would be a nice solution for some cases. But how would this work when everything gets rerendered from the top? |
@cody Just like
|
@syranide As I understand this, if everything gets rendered from the top, then
|
@cody Ah, yes I see what you mean now, that's a good point. I'm getting an uneasy feel thinking about all this now... hmm... |
I don't think we'll do this since providing a new key is easy and we're trying to reduce API surface area, not increase it. Thanks for the idea. |
We support uncontrolled components (although we do not necessarily encourage them) and it seems to me that this is a utility that is of relevance to a handful of such use-cases, especially in more complex situations. I.e. where you have a stateful component which you need to reset, say a rich-text editor or in my case of ReactSWF a running SWF, in response to some user action. EDIT: Think of it as a complement to
React.findDOMNode(inputRef).value = 'foobar'
.This can currently be worked around by providing a monotonic
key
, but that's really just a hack and not a neat solution.This is very much in the more obscure end of the spectrum but seems like a missing feature in-terms of being "feature complete" for uncontrolled components. So I'm not really going to push hard for this (especially as it could be really obscure and the above hack might really be the best trade-off, also considering batching).
The text was updated successfully, but these errors were encountered: