I'm working on an adapter for inertia.js with solid, and I was looking to add providers similar to their persistent layouts, but I can't seem to get the provider to attach to the component properly. The component is not being wrapped in the provider how I was intending it to. I don't know if it's even possible to do it this way.
function Create(props) { return ( <div> <h1>Hello</h1> </div> );}// How Inertia attaches persistent layouts to componentsCreate.layout = (page) => ( <div style={{ border: "1px solid red" }}>{page}</div>);// How I am trying to pass the providerCreate.provider = (page) => ( <TestContextProvider>{page}</TestContextProvider>);export default Create;
function Create(props) { return ( <div> <h1>Hello</h1> </div> );}// How Inertia attaches persistent layouts to componentsCreate.layout = (page) => ( <div style={{ border: "1px solid red" }}>{page}</div>);// How I am trying to pass the providerCreate.provider = (page) => ( <TestContextProvider>{page}</TestContextProvider>);export default Create;
const renderPage = ({ Component, props, key,}) => { const child = createComponent(Component, { key, ...props }); // Trying to call the provider similar to the layout below // return Component.provider(child); // Inertia adapters attach layout to the component here if (Component.layout && typeof Component.layout === "function") { return Component.layout(child); } return child;};
const renderPage = ({ Component, props, key,}) => { const child = createComponent(Component, { key, ...props }); // Trying to call the provider similar to the layout below // return Component.provider(child); // Inertia adapters attach layout to the component here if (Component.layout && typeof Component.layout === "function") { return Component.layout(child); } return child;};