How do i make a react component context?
I manage to make it working, but happens that i`m unable to achieve this by the lack of understanding react.
I'll share my code. I want to do a 4 page components, apearing inside the main page. And as soon as i click on a new link, the set of 4 pages, change to a new set. But not using routing, only using context.
Is that possible? Link to sample on code sandbox: Codesandbox example
1条答案
按热度按时间9q78igpj1#
我认为你的例子是正确的。但是钩子不是上下文,所以你是对的,你需要把
useTransistorInit
变成一个上下文,比如对象。我最近帮助了一个有类似问题的人,你可以在这里看看。如何取回被过滤的数据(ReactContextAPI)