Context Performance

This commit is contained in:
Belen Curcio
2020-10-26 20:13:05 -03:00
parent f6beae6e38
commit 2da59ba533
5 changed files with 33 additions and 28 deletions

View File

@@ -20,15 +20,17 @@ const Input: React.FC<Props> = (props) => {
}
return (
<input
className={rootClassName}
onChange={handleOnChange}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
{...rest}
/>
<label>
<input
className={rootClassName}
onChange={handleOnChange}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
{...rest}
/>
</label>
)
}

View File

@@ -1,4 +1,4 @@
import React, { FC } from 'react'
import React, { FC, useMemo } from 'react'
import { ThemeProvider } from 'next-themes'
import { SSRProvider, OverlayProvider } from 'react-aria'
@@ -144,18 +144,21 @@ export const UIProvider: FC = (props) => {
const setModalView = (view: MODAL_VIEWS) =>
dispatch({ type: 'SET_MODAL_VIEW', view })
const value = {
...state,
openSidebar,
closeSidebar,
openDropdown,
closeDropdown,
openModal,
closeModal,
setModalView,
openToast,
closeToast,
}
const value = useMemo(
() => ({
...state,
openSidebar,
closeSidebar,
openDropdown,
closeDropdown,
openModal,
closeModal,
setModalView,
openToast,
closeToast,
}),
[state]
)
return <UIContext.Provider value={value} {...props} />
}