From e0aed3fbfb095042e69d329f6a1490f5ec0e6042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatas=20de=20Oliveira=20Co=C3=AAlho?= Date: Tue, 18 Jan 2022 14:28:35 -0300 Subject: [PATCH] Update react-router examples to use v6 version (#4199) * Update react-router examples to use v6 version The exemple used to demonstrate Code-Splitting using react-router-dom is outdated. My suggestion is to use the new way of calling routes that was introduced in React Router v6 * remove index prop --- content/docs/code-splitting.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/docs/code-splitting.md b/content/docs/code-splitting.md index aa8a467bb..30aef4856 100644 --- a/content/docs/code-splitting.md +++ b/content/docs/code-splitting.md @@ -178,7 +178,7 @@ Here's an example of how to setup route-based code splitting into your app using ```js import React, { Suspense, lazy } from 'react'; -import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; +import { BrowserRouter, Routes, Route } from 'react-router-dom'; const Home = lazy(() => import('./routes/Home')); const About = lazy(() => import('./routes/About')); @@ -186,10 +186,10 @@ const About = lazy(() => import('./routes/About')); const App = () => ( Loading...}> - - - - + + } /> + } /> + );