Changing State Of Component With Onclick In React
I am trying to change state of the component and render it to page. I have an if statement in handleClick(event) which validates if function has to be run and rerender elements.
Solution 1:
Put navbarValue in a state object and update the state onClick. You don't need if/else statements here. Because your components will be rerendered on state update.
Like this: https://stackoverflow.com/a/45134876/4953199
Post a Comment for "Changing State Of Component With Onclick In React"