Answer the question
In order to leave comments, you need to log in
How to display dynamic content in template page, React?
Hello everyone, I'm new to React, I would be very grateful if you could help. I'm
using the MERN stack and Context API for the project and React Router for routing.
There is such a feature here: the user logs in and selects any hostel from the 12 available, the number of the selected hostel is recorded in local storage. After choosing, he is redirected to the site itself, where he can visit the pages "Information about the hostel" and "Administration of the hostel". How can I make the text on these pages refer to the hostel he has chosen? That is, there should be 12 identical pages with different text. There is a lot of text, for example, a list of teachers, the address of the hostel, the phone number of the hostel, and so on.
Pass huge chunk of html to props and inject with dangerouslySetInnerHTML?
Now everywhere, regardless of the selected hostel, the About.js or Administration.js components are simply displayed, with the same text
Answer the question
In order to leave comments, you need to log in
Make one page.
There will be information blocks on the page.
You send text, a list of teachers, photos, etc. into this component of the old house
with props. You take data from the backend, according to your hostel ID.
It is also not necessary to store the ID in the local store, you can specify id as a url parameter and access it throughuseParams()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question