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
|
||||
}
|
||||
|
||||
const initialState = {
|
||||
const initialState: State = {
|
||||
displaySidebar: false,
|
||||
displayDropdown: false,
|
||||
displayModal: false,
|
||||
@ -178,8 +178,16 @@ export const useUI = () => {
|
||||
return context
|
||||
}
|
||||
|
||||
export const ManagedUIContext: FC = ({ children }) => (
|
||||
<UIProvider>
|
||||
<ThemeProvider>{children}</ThemeProvider>
|
||||
</UIProvider>
|
||||
)
|
||||
interface ManagedUIContextProps {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
// 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