T
T
Toma2018-06-20 14:18:31
React
Toma, 2018-06-20 14:18:31

What is better to use to get the current url?

is it better to get the path using window.location.pathname or wrap the component in withRouter and get the path from props? (for different checks)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-06-20
@maxfarseer

If the component does not need to check anything that provides the withRouter functionality , then why call it? Take from location.
Otherwise, withRouter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question