Skip to content

Instantly share code, notes, and snippets.

Avatar

johnlewisdesign

View GitHub Profile
@siakaramalegos
siakaramalegos / basic_router.jsx
Last active Mar 28, 2021
Basic example of React Router: BrowserRouter, Link, Route, and Switch
View basic_router.jsx
// BrowserRouter is the router implementation for HTML5 browsers (vs Native).
// Link is your replacement for anchor tags.
// Route is the conditionally shown component based on matching a path to a URL.
// Switch returns only the first matching route rather than all matching routes.
import {
BrowserRouter as Router,
Link,
Route,
Switch,
} from 'react-router-dom';