Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

× Error: Invariant failed: You should not use outside a

You need to wrap the Switch with BrowserRouter or other alternatives like HashRouter, MemoryRouter. This is because BrowserRouter and alternatives are the common low-level interface for all router components and they make use of the HTML 5 history API, and you need this to navigate back and forth between your routes.

Try doing this rather

import { BrowserRouter, Switch, Route } from 'react-router-dom';
And then wrap everything like this

<BrowserRouter>
 <Switch>
  //your routes here
 </Switch>
</BrowserRouter>
Comment

Error: Invariant failed: You should not use outside a

import { BrowserRouter, Switch, Route } from 'react-router-dom';
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue date helper 
Javascript :: regular expression to validate m/d/yyyy HH:MM:SS AM 
Javascript :: how to log bodyparser error 
Javascript :: javascript code to test if screen is idle 
Javascript :: js display property 
Javascript :: string to number javascript 
Javascript :: javascript target closest id 
Javascript :: javscript randomly generate 89digit number 
Javascript :: array.find 
Javascript :: how to clear all slash commands 
Javascript :: vue trigger function after certain time 
Javascript :: using filter and pipe in rxjs 
Javascript :: copying table element to clipboard using javascript 
Javascript :: exit node 
Javascript :: three ways of writing a function in javascript 
Javascript :: get time in google apps script 
Javascript :: write buffer to file in node 
Javascript :: sort array of objects based on another array javascript 
Javascript :: how to check with jquery if bootstrap modal is hidden or shown 
Javascript :: .then message.delete 
Javascript :: ffmpeg thumbnail generator SIZE 
Javascript :: onclick remove textarea value 
Javascript :: validate ajax nonce request wordpress 
Javascript :: query selector 
Javascript :: body onload jQuery | jQuery equivalent of body onLoad 
Javascript :: got bearer auth 
Javascript :: ag grid angular examples 
Javascript :: node js create or check directory 
Javascript :: display month friday 13th javascript year 
Javascript :: get parent class javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =