How to work with the ranting and received from the server?

Work with a fake api, but wondered how to add ranting. Before only created ranting and using react-router, I added them by hand
In the case of the server, I have load of ranting and go through them in a loop to record the route?
June 10th 19 at 16:28
1 answer
June 10th 19 at 16:30
Solution
Why do you need to load of ranting? You have to add in the Annex 6 of the main ranting:
/posts
/comments
/albums
/photos
/todos
/users


A specific entity open with parameters, for example postId:
<route path="/post/:postId" component="{Post}/">

const Post = ({ match, postsMap }) => {
 const post = postsMap[match.params.postId];
 return (
the <div>
<h1>{post.title}</h1>
<p>{post.body}</p>
</div>
}</route>

Generally to get the post from the list of posts it is better to use a selector pattern. But that is beyond the scope of the topic of the question, so an example will not write. But I advise you to watch the library reselect.

The list of posts receive the GET request, and will render the by using Link:
<list>
 {postsList.map(post => (
 <link to="{`/post/${post.id}`}" key="{post.id}">{post.title}
))}
</list>
Thank you very much for the clarification! - unique commented on June 10th 19 at 16:33

Find more questions by tags React