UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

27 lines (24 loc) • 720 B
import { forwardRef, useEffect, useRef } from "react"; import { jsx } from "react/jsx-runtime"; const NavigationContent = ({ render, children }) => { return render(children); }; function useComponent(render) { const renderRef = useRef(render); renderRef.current = render; useEffect(() => { renderRef.current = null; }); return useRef(forwardRef(({ children }, _ref) => { const render2 = renderRef.current; if (render2 === null) { throw new Error("The returned component must be rendered in the same render phase as the hook."); } return /* @__PURE__ */ jsx(NavigationContent, { render: render2, children }); })).current; } export { useComponent }; //# sourceMappingURL=useComponent.mjs.map