mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 13:11:23 +00:00
pulled changes from develop -- converted ManagedUIContext to a function (non-arrow) with explicit React.ReactNode props -- url to article explaining benefits of this revised configuration included in a comment (compone
nts/context, line 185)
This commit is contained in:
parent
aa36894605
commit
a7befda2c9
@ -10,7 +10,7 @@ export interface State {
|
|||||||
toastText: string
|
toastText: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState = {
|
const initialState: State = {
|
||||||
displaySidebar: false,
|
displaySidebar: false,
|
||||||
displayDropdown: false,
|
displayDropdown: false,
|
||||||
displayModal: false,
|
displayModal: false,
|
||||||
@ -178,8 +178,16 @@ export const useUI = () => {
|
|||||||
return context
|
return context
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ManagedUIContext: FC = ({ children }) => (
|
interface ManagedUIContextProps {
|
||||||
<UIProvider>
|
children: React.ReactNode
|
||||||
<ThemeProvider>{children}</ThemeProvider>
|
}
|
||||||
</UIProvider>
|
|
||||||
)
|
// please see https://medium.com/variant-as/a-better-way-to-type-react-components-9a6460a1d4b7
|
||||||
|
export function ManagedUIContext(props: ManagedUIContextProps) {
|
||||||
|
const { children } = props
|
||||||
|
return (
|
||||||
|
<UIProvider>
|
||||||
|
<ThemeProvider>{children}</ThemeProvider>
|
||||||
|
</UIProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user