V
V
Valera Udav2017-05-16 17:44:48
JavaScript
Valera Udav, 2017-05-16 17:44:48

How to deep nest an unknown value in React Router?

This is my first serious application on react, the process is very long, I'm tinkering with every little thing.
Essence of the question: there are catalogs and products. Each catalog can have an unknown number of nestings of other catalogs, or not have nestings at all, but immediately contain products (standard online store).
The question itself is: how can I organize routing so that I can have an infinite number of nestings, and can also read the entire chain of parents that came from the url?
What we have now:
Setting the routing for the directory When accessing /catalog/1/2 we get the result: Expected result PS It would be nice to find a working component of breadcrumbs for this whole thing. PPS React v.15.5.4, React Router v.4.1.1
<Route path='/catalog/:id' component={Catalog} />
Каталог 1
Каталог 2 (список родителей: Каталог 1)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
scrpcc1, 2017-05-17
@scrpcc1

I spat on RR and based on the article https://medium.com/@daveford/react-router-alternat... I made my own. It turned out faster than trying to get react router to work as required
In the parsePath function, write your path parsing and you can process the parameters as you like.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question