Pass match.params into another component

0

I have the following problem:

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

Well, in the step I can get the id passed with the code this.props.match.params.id only 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 the route so that I called the form directly and so I would have the id, but I need to render the setp and inside the form.

How do I pass the step id to the form?

My route looks like this:

<Route path="/stepAluno/(new|edit)/:id?" component={StepAluno} />
    
asked by anonymous 18.10.2018 / 22:40

1 answer

0

I was able to resolve it as follows:

After getting the id by match.params , I passed the id via props to the form component.

    
21.10.2018 / 15:57