canUnmount

Invoked before the unmount process.

Returns

boolean True if the component should unmount.

Example

const Example = new class extends Component {
    mounted() {
        this.unmount();
    }
    canUnmount() {
        return false;
    }
    render() {
        return `
            <p>This component won't be unmounted.</p>
        `;
    }
}();

Example.mount(document.getElementById("root"));

Last updated