Y
Y
Yura Komarov2018-12-06 21:56:00
React
Yura Komarov, 2018-12-06 21:56:00

How to get the category id when clicking on a category?

Good evening everyone. I am writing a sample application in react. https://yurajun.github.io/react-test
The crux of the matter. How to get the category id when clicking on a category (left column)?
When I click on the phone and go to this page, I can easily get the id from match.params.id, but I can't handle the category. (I can't get the id from the match.params object)
This object is displayed in the console every time I click.
The application code can be viewed in the console in the sources section in the left column in the webpack folder in the subfolder " ."
The script folder is the input to the application
The app folder is the main blocks.
The application has a minimum of code to make it easier to understand. I understand how difficult it is to understand a large application.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-12-06
@Yurajun

Because match.params in categories does not and cannot contain the category id, since there are several categories and their id are contained in the categories array passed to the component

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question