I want to trigger react component from other component. What is the best way to do it? I don't want to create new flag on redux store like "shouldShowMenu". I thinking about static method in react but i not expert in react.
import Menu from './component/menu'
const clickfeed = () => {Menu.staticClickEvent()}
<Provider>
<Menu>
<Feed onClick={clickfeed}/>
</Provider>
can i use static method like this and should i use static method change the component state.
You don't need
redux
for this. You can useref
to do this. Hope it helps!You should go ahead and create that
shouldShowMenu
flag in your redux store. Once you have components interacting that way, it's an application state. It seems excessive at first but once you start having a value that is shared across components, this will save you a lot of headaches!