Grouping/Combining multiple context providers
Does anyone know how I can group multiple context providers to my <App /> Without nesting a bunch of it?
4 Replies
import React, { useContext } from 'react';
import { Context1, Context2, Context3 } from './contexts';
function MyApp() {
// Access multiple contexts
const dataFromContext1 = useContext(Context1);
const dataFromContext2 = useContext(Context2);
const dataFromContext3 = useContext(Context3);
// Your component logic using data from multiple contexts
return (
<div>
{/* Your JSX */}
</div>
);
}
export default MyApp;
You can use this
https://github.com/solidjs-community/solid-primitives/tree/main/packages/context#multiprovider
GitHub
solid-primitives/packages/context at main · solidjs-community/solid...
A library of high-quality primitives that extend SolidJS reactivity. - solidjs-community/solid-primitives
This is not a React server 🙂
Thanks this is what i was looking for