Reparentable
Import the createReparentableSpace method from the package.
#
Setup โ๏ธFirst you need to define a Space that will virtually contain the components. Only <Reparentable>
s belonging to the same space can send children to each other.
The <Reparentable>
must be the direct parent of the children which can be transferred, and it must have an unique id that differentiates it from other <Reparentable>
s in its Space.
#
Usage ๐Let's define a very simple child component for the example.
We define in our app two simple parent components, and insert within them the <Reparentable>
s.
Now we can reparent anywhere in our app using the sendReparentableChild
method.
#
Example ๐กCheck out the full example on codesandbox.