React router Link not causing component to update within nested routes

后端 未结 5 1404
栀梦
栀梦 2021-02-07 14:46

This is driving me crazy. When I try to use React Router\'s Link within a nested route, the link updates in the browser but the view isn\'t changing. Yet if I refresh the page t

5条回答
  •  生来不讨喜
    2021-02-07 14:57

    It's good to share the components code also. However, I tried to recreate the same locally and is working fine for me. Below is the sample code,

    import { Route, Link } from 'react-router';
    import React from 'react';
    import App from '../components/App';
    
    const Home = ({ children }) => (
      
    Hello There Team!!! {children}
    ); const PortfolioDetail = () => (
    ); const PortfolioItemDetail = () => (
    PortfolioItemDetail
    ); const NoMatch = () => (
    404
    ); module.exports = ( );

提交回复
热议问题