React-router not loading css for nested pages on refresh

后端 未结 7 494
甜味超标
甜味超标 2020-12-25 12:07

I\'m trying to setup a react-router for my first React webapp, it seems to be working except that the css doesn\'t load for my nested pages when I refresh the p

7条回答
  •  有刺的猬
    2020-12-25 12:49

    I had this problem too, where my app wasn't loading style sheets and the like. However, I was importing my assets directly into my index.html entry point.

    By replacing the links with absolute paths as per this documentation, my problem was resolved.

    For me, this meant changing

    
        
    
    

    to this:

    
        
    
    

    I'm not sure if the same thing would work for your import statements, but it is worth a shot.

    FYI I'm using the project layout from create-react-app.

提交回复
热议问题