@rbxts/react-gates
v0.0.5
Published
fancy way to use react portals!
Readme
🌌 react-gates
fancy way to use react portals!
❤️ credits
- wAD (wad4444)
- SUMER (sumer_real)
🌩️ installation
npm install @rbxts/react-gates
✍️ example usage
export enum MyDestinations {
FirstGate = "firstGate",
SecondGate = "secondGate",
}
function RootComponent() {
const firstGate = useGateDestination(MyDestinations.FirstGate); // returns destination, which you need to pass as reference to the element that other elements will teleport to
const secondGate = useGateDestination(MyDestinations.SecondGate);
return <frame ref={combineDestinations(firstGate, secondGate)} />; // combineDestinations need to be used only if you need to put 2 or more destinations to one element
}
function OtherComponent() {
const FirstGate = useGate(MyDestinations.FirstGate); // returns element that will teleport children to destination
return (
<FirstGate>
<frame key="some child">
</FirstGate>
);
}