createParent
Get the createParent method from the package.
#
Setup โ๏ธYou can generate a parent instance to use the send
method within a class component. That component must be the direct parent of the children which can be transferred. createParent
must be called in the constructor.
If you want to use another component as parent, you can provide a function that defines that component (You need to know the structure of the React fibers).
#
Usage ๐Let's define a very simple child component for the example.
We use two <Parent>
components in the app as defined above.
Now we can reparent anywhere in our app using the send method.
#
Example ๐กWork in progress.