Skip to content

React Context

This example isolates the React context support in @litsx/babel-preset-react-compat.

It keeps the authored React shape:

  • createContext(...)
  • <ThemeContext.Provider value={...}>
  • useContext(ThemeContext)
  • <ThemeContext.Consumer>{...}</ThemeContext.Consumer>

but lowers that surface onto Litsx plus @lit/context.

What To Notice

  • the authored API still looks like React
  • the compat layer owns the lowering details
  • this is migration support, not a native Litsx context primitive

Next