#React.js

17 messages · Page 1 of 1 (latest)

vernal ridge
#

What is it supposed to do?

dusk narwhal
#

Its navbar

#

When I will click on getUser

#

It fetches users

#

It works if I just add
<Struct/> to the app.js

#

but I want to make it an event listener function

#

seems like what Im fetching is "object"

#

And onClick={} seems to have some trouble with it

vernal ridge
#

Is onclick supposed to render Struct when you click on the button?

dusk narwhal
#

Yea, it was a desperate method to solve the bug

#

Earlier I tried to pass the function as a prop

fast cipher
#

try to write that struct function before this image return. and then <button onClick={(e)=> YoureFunctionName()}>Please press here </button>

robust crag
#

Realistically it would make sense to just use a Boolean which is used to determine whether the Struct component should be rendered

#

So you could just just set that to true on click

vernal ridge
#

Yeah, conditional rendering makes more sense

dusk narwhal
#

I made it class based completely

#

Works good