Custom Renderer ๐Ÿ”Œ

The default configuration is designed to work with ReactDOM. If you want to try implementing React-Reparenting with other renderers you can try to instruct the package to manage the types of nodes you are working with, in order to automate the process as happens with ReactDOM.

import {configure} from 'react-reparenting';
// The default configuration that works with ReactDOM.
configure({
appendChildToContainer(container, child) {
container.appendChild(child);
},
insertInContainerBefore(container, child, before) {
container.insertBefore(child, before);
},
removeChildFromContainer(container, child) {
container.removeChild(child);
},
isElement(elementType, stateNode) {
return stateNode instanceof Element;
},
});

If you have successfully implemented reparenting with React Native or with your custom renderer, feel free to share your solution by opening an issue on Github.