DEV Community

Marc Krivitzky
Marc Krivitzky

Posted on

ReactJs - passing state as props using an onClick event (help please)

Hello everyone! I am very new to Developing, I have been learning Java Script, CSS, and HTML for about a year. The last three months I have pivoted to using ReactJs. Would love some help figuring out an issue I have been facing the last few days.

I am creating a simple battle type game. At the moment I am having trouble passing along state and props with an onClick event. (Also I am only comfortable using class components unfortunately so any help would be greatly appreciated on that format)

Top comments (2)

Collapse
 
bhavyashah profile image
Bhavyashah

Hello Marc,

Can you send some screenshot of code that help us to solve your query easily.

Instead of using class use a Hooks it help you to decrease the length of code and also you can switch a state to another state easily.

So please send some screenshot of code. So we can help you easily.

Collapse
 
kjgm profile image
Karam Jammal

Hello Marc, welcome to the DEV community, If you still need help, here is my discord account: Toras#2778, send me a message, and let's try to fix the issues.