0.0.9 • Published 4 months ago

@-ft/watch-target-react v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

watch-target-react - Util watchTarget wrapper for React

React wrapper of util watchTarget

Usage

function Portal({ children }) {
  const { addComponent } = useContext(PortalContext);
  const childrenWatchTarget = useLayoutWatchTarget(children);
  useEffect(
    () => addComponent(toComponent(childrenWatchTarget.watch)),
    [addComponent]
  );
  return null;
}

function toComponent(childrenWatchTarget) {
  return function Component() {
    return <>{useWatchValue(childrenWatchTarget)}</>;
  };
}
0.0.9

4 months ago

0.0.8

4 months ago

0.0.7

8 months ago