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:
Andrew Ross 2020-12-12 13:42:36 -06:00
parent aa36894605
commit a7befda2c9

View File

@ -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>
)
}