Skip to content
Advertisement

My imported component seems to not be taking in my state values

JavaScript

here I want to invoke the MineralOutput component after the submit button and pass in the age, gender, and userid with state.

JavaScript

This is the component that I imported.

JavaScript

When I click the submit button, I get a 404 status code error. I’m using Axios for requests and it has already worked before when I wanted to post inside a class. But, this time I want to try and post by importing a component and passing in the values.

Advertisement

Answer

Solved by @windowsill. My “Component” MineralOutput wasn’t a component, but a function. So instead of <MineralOutput /> I just needed to call it like MineralOutput(1,2,3)

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement