description |
---|
Allows the host that instantiates this useProvider to become the context. |
This hook enables you to take control of the context from the component that instantiates useProvider
, thus avoiding the need to instantiate the context node in the DOM.
import { createContext, useProvider, c } from "atomico";
export const Theme = createContext({
color: "white",
background: "black"
});
export const App = c(()=>{
useProvider(Theme,{
color: "red",
background: "yellow"
});
return <host shadowDom><slot/></host>
});
Avoid creating an instantiable context node in the DOM.