I have a SideBarBlurChange component, I need to pass a value called values inside the BlurChangeValue array, which is inside CreateContext.
On the Internet I did not find a suitable example, I hope that it is possible to reolize, because so far I have no other options for reolizing. I want to show a screenshot of what I want to do to make it clearer for you
export const BlurContext = createContext({ BlurChangeValue: [], }); export default function SideBarBlurChange(props) { const ls = parseInt(window.localStorage.getItem('values')); const [values, SetValues] = useState(ls ? [ls] : [20]); const SaveChanges = () => { localStorage.setItem('values', values); } return ( <> <BlurContext.Provider values={values}> // jsx </BlurContext.Provider> </> ); } https://stackoverflow.com/questions/66020517/react-how-to-pass-hook-value-to-createcontext February 03, 2021 at 10:44AM

没有评论:
发表评论