Open a modal of another POO React class

Asked

Viewed 229 times

0

I’m learning Javascript and POO so I may be doing something stupid, I’m trying to make a navbar and this navbar open different functions of different classes in other files.

That part where you have the go arrow, the text 'products' and the icons is the header: https://i.imgur.com/wQUumMQ.png The rest, down is from formProduct page

Full code:

src/Components/Header/index.js: https://hastebin.com/acaboqeyog.cs

src/pages/formProduct/index.js: https://hastebin.com/sixitemori.cs

The way I did I can perform the hi function, which takes a state and an Alert on the screen, but I can’t perform the function . new that opens a modal to create a new product... Why?

In this case, in the header (src/Components/Header/index.js), on line 173, I can use:

<Ionicon icon="md-add-circle" fontSize="35px" color="#0069d9" onClick={ products.oi } />

But I can’t use it:

<Ionicon icon="md-add-circle" fontSize="35px" color="#0069d9" onClick={ products.new } />

Why? What am I doing wrong?

  • Dude, try to put the images and codes needed to reproduce the problem directly in the question instead of using external links, also read [mcve].

  • I didn’t understand why to create a new instance, wouldn’t it be the case to just render the formproduct class as modal? Or create a modal hoc and pass the Component you want to render into it.

  • The codes are in hastebin The instance was just a way that I found to perform functions of the other class that is in another file The strange thing is that I can perform the Hi function, but I can’t run the new one that creates a modal Why? Can’t run a modal from another class?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.