Open gera2ld opened 6 years ago
Why need unmount Content ?
Because unmount
triggers in React@15. I think they should keep consistent.
Example usage:
<Modal visible={visible}>
<ModalCounter />
</Modal>
ModalCounter
can be used to count how many modals are available to a user at the moment.
By using React@16 with antd, I have to change the code like this:
<Modal visible={visible}>
{visible && <ModalCounter />}
</Modal>
This has to be done EVERYWHERE, and I can't see any benefits. Why would we want to see what the modal had last time? Can we add an option to disable this cache behavior?
I see.
Any updates?
When using React@16,
componentWillUnmount
of child components will not be triggered until the modal is destroyed or it's visible with different children.For example:
Expected result
Both
mount
andunmount
should be logged.Actual result
Only
mount
is logged.