Why the account component is not rendered

clipboard.png

clipboard.png

return

        <Link to="/" style={{background:"red",width:10,height:10,display:"block"}}>
            </Link>
            <div className={styles.nav}>

                <li>
                    <Link to="/home/account">
                    <img src={account}/>
                    account</Link>
                </li>
                <li>
                    <Link to="/home/mining">mining</Link>
                </li>
                <li>
                    <Link to="/home/price">price</Link>
                </li>
                <li>
                    <Link to="/home/chat">Chat</Link>
                </li>
                <li>
                    <Link to="/home/setting">Setting</Link>
                </li>
                <li>
                    <Link to="/home/help">help</Link>
                </li>
            </div>
            <div>
                <Switch>
                    <Route path="/home/account" exact component={Account}></Route>
                    <Route path="/home/mining" component={Mining}></Route>
                    <Route path="/home/price" component={Price}></Route>
                    <Route path="/home/chat" component={Chat}></Route>
                    <Route path="/home/setting" component={Setting}></Route>
                    <Route path="/home/help" component={Help}></Route>
                </Switch>
            </div>
    </div>
Mar.11,2021

roughly estimate that your current address is under / , not under / home/account


remove exact


add a withRouter to try https://reacttraining.com/rea.

.
Menu