DEV Community


Discussion on: How to use toggle outside of class component render and toggle inside variable reactjs?

fernandoperigolo profile image
Fernando Souza

I tried to understand your question, but I can't. I recommend you to ask what you want to do as project, the goal, instead ask how to put some code that way.
I see you trying to make react works as you wish instead try to understand how react works.

Can you try to put you question other way? Maybe I can help you

nikhilroy2 profile image
Nikhil Chandra Roy Author

I want to use toggle inside myKey function see

when I hit enter after type some text I need the click button toggle but the toggle not working, I will appreciate you if you try to fix it.