Answer the question
In order to leave comments, you need to log in
What about routing and categories?
There are categories on the site, the link is in brackets, the link
must be in the form of a slug, and
not
just
an
id category/4-detektivi)
The whole thing is formed from an array of objects, where the object looks like this:
{id:1,name:"comedies",slug:"1-komedii"}
I click on the link and the /category/:name route is triggered
After that, I need to contact the API, which will return to me all the films related to 1-komedii The
question
is, is it normal practice if I parse the URL, take the ID from there and send this ID to the API? nibudl reference type getID['1-komedii']//1
In general, I can figure out how to competently load movies by clicking on a category.
It turns out some shitty code.
The question is at what stage and where exactly and how to convert SLUG to ID.
For converting, you need a directory, is it normal if I generate an additional branch in the Store based on my categories stupidly for the directory?
using redux , redux-thunk
Answer the question
In order to leave comments, you need to log in
Write on the server a GET request for a category by slug and preferably without a prefix with a number. This will be the best option.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question