Pass match.params into another component

Asked

Viewed 1,034 times

0

I have the following problem:

I have a step component and inside that component I have another component called form that renders one of the step steps.

Well, on step I can get the id passed with the code this.props.match.params.id only that in this step I have another component called form and in this form I lose the id reference passed to the step.

I know I could change on the route for it to call straight the form and so I would have id, but I need to render the setp and inside it the form.

How do I pass the step id to the form?

My route is like this:

<Route path="/stepAluno/(new|edit)/:id?" component={StepAluno} />

1 answer

0

I was able to solve it this way:

after obtaining the id by match.params, I passed the id via props for the form component.

Browser other questions tagged

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