UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

30 lines (29 loc) 755 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