خرید بک لینک

Vote count: 0

A little react-router common knowledge

With react-router, you can use the match function on the server to match the routes to a location without rendering. The callback is passed renderProps which contains an array of components that will eventually be rendered for the matched route.

What I am doing

On the server, I'm using that matched list of components to pre-fetch data (from an API) before rendering. This is pretty common.

I want to do something similar on the client, pre-fetch data before transitioning to the next route. Except, according to the docs:

Note: You probably don't want to use this in a browser unless you're doing server-side rendering of async routes.

Here's the question

  1. Does that mean it is not safe to use to the same way on the client?
  2. Is there another function I should be using to get the matched list of components on the client?

Thank you.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 30 فروردين 1395 ساعت: 9:59

صفحه بندی