U
U
uRoot2020-07-12 18:56:02
React
uRoot, 2020-07-12 18:56:02

How to properly render the product/article/etc itself when it is opened?

Let's say we have a list of products. When you click on the product itself, I have to display it by displaying all the information about it. How to do it right?

I know a way with route parameters:

<Route path="/products/:id" render={(id) => <ProductСard id={id} />} />
Well, based on the route parameter (id), I render the product itself. But how correct is this approach?

After all, there are options in which this approach does not work, for example, if the site needs CNC.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
McBernar, 2020-07-12
@uroot

Well, then instead of id there should be some slug that is parsed and searched in the database by this name, and not by id. The meaning is the same.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question