Ionic React js -如何创建组件上下文

bvuwiixz  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(137)

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

9q78igpj

9q78igpj1#

我认为你的例子是正确的。但是钩子不是上下文,所以你是对的,你需要把useTransistorInit变成一个上下文,比如对象。
我最近帮助了一个有类似问题的人,你可以在这里看看。如何取回被过滤的数据(ReactContextAPI)

相关问题