3 ms·
Or even better, provide a top level configuration option, like: ReactDOM.render(element, document.getElementById('root'), {memo: true}); Just dreaming...
by midrus 5y ago
Or even better, provide a top level configuration option, like:
ReactDOM.render(element, document.getElementById('root'), {memo: true});
Just dreaming...
- catlifeonmars 5y agoThis one is interesting, because React has a separation between the renderer and the library. There is a different renderer for e.g. react native, or even for the terminal (!!). It’s a little ambiguous where memoization falls (does it belong to the renderer, or to the core?). I totally agree that being able to switch on behavior for an entire tree or subtree would be ideal, but react tends to use components for that as well (e.g. <React.StrictMode>). Perhaps this should be a component, it could even be implemented via the context system.