I am new to React Hooks.
I have been working on re-rendering after the button is clicked.
From my example, there are two buttons. One is to increment the count and the other is to remove the content. When I click a remove button, the content becomes null in order to reset the count.
What I want to try is to display the new content with the new count which is zero when the render button is clicked.
However, the issue is when I click the render button, it shows nothing.
I believe that the reason is because I have set null to remove the content in my condition which is logically incorrect. I have looked at the other questions related to this problem, but I haven't found any proper way to solve it.
Can anybody help me to figure this out?
rendernever changes in functionality, so you won't be able to render the data once it's been removed. You just need to update therenderbutton'sonClicktoonClick={() => setRender(!render)}.