How can I reset a react component including all transitively reachable state?

To ensure that the implicit browser state you mention and state of children is reset, you can add a key attribute to the root-level component returned by render; when it changes, that component will be thrown away and created from scratch.

render: function() {
    // ...
    return <div key={uniqueId}>
        {children}
    </div>;
}

There’s no shortcut to reset the individual component’s local state.

Leave a Comment