paint-brush
WithRouter-Advanced Features of React Router for Single Page Appsby@gregfilipczak
36,689 reads
36,689 reads

WithRouter-Advanced Features of React Router for Single Page Apps

by Greg Filipczak4mSeptember 18th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Last week, I outlined a <a href="https://hackernoon.com/simple-guide-to-creating-a-single-page-app-with-react-router-6b6f709a2e3f" target="_blank">basic setup for React Router to set up a single page application</a>. I used a portfolio site as an example, and there wasn’t much complexity to the components being used. However, you’ll often have the need for deeply nested components, so React Router includes the withRouter method to give you access to the match, location, and history properties of the browser’s native API necessary to make your Link and Route components work correctly. It’s fairly easy to use, but there are a few issues to watch out for when using it. Here’s a contrived, basic example:

Company Mentioned

Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - WithRouter-Advanced Features of React Router for Single Page Apps
Greg Filipczak HackerNoon profile picture
Greg Filipczak

Greg Filipczak

@gregfilipczak

L O A D I N G
. . . comments & more!

About Author

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite