Invariant Violation: You should not use outside a

后端 未结 10 1402
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 00:30

I have a problem that I don\'t know how to solve, I get this error when running npm test

Invariant Violation: You should not use

10条回答
  •  一生所求
    2021-02-01 00:58

    Always put BrowserRouter in the navegations components, follow the example:

    import React, { Component } from 'react'
    import { render } from 'react-dom'
    import { BrowserRouter, Route, NavLink, Switch } from 'react-router-dom'
    
    var Componente1 = () => (
    Componente 1
    ) var Componente2 = () => (
    Componente 2
    ) var Componente3 = () => (
    Componente 3
    ) class Rotas extends Component { render() { return ( ) } } class Navegacao extends Component { render() { return (
    • Comp1
    • Comp2
    • Comp3
    ) } } class App extends Component { render() { return (
    ) } } render(, document.getElementById("root"))

    Note: the BrowserRouter accept only one children element.

提交回复
热议问题