Closed UpperCod closed 2 years ago
Describe the solution you'd like
Core level context api, example:
createContext
import { createContext } from "atomico"; const MyContext = createContext({value: 0}); customElements.define("my-context", MyContext );
useContext
import { useContext } from "atomico"; import { MyContext } from "./my-context"; function component(){ const context = useContext(MyContext ); return <host>{context.value}</host> }
Additional context
This proposed API facilitates a connection between components and improves the typing of contexts at the TS level.
At a general level, an api based on a Consumer component is not exposed, since for this there is useContext at the internal level of Atomico
The return of createContext is an unregistered CustomElement
Describe the solution you'd like
Core level context api, example:
createContext
useContext
Additional context
This proposed API facilitates a connection between components and improves the typing of contexts at the TS level.
At a general level, an api based on a Consumer component is not exposed, since for this there is useContext at the internal level of Atomico
The return of createContext is an unregistered CustomElement