LoginSignup
0
0

More than 5 years have passed since last update.

react-router でURLを直打ちしたときにアセットを正しく表示できない。

Last updated at Posted at 2018-02-01

現象

react-router を使っていて、/users/:id のようなネストしたURLを直打ちした際、アセット(今回は画像)をうまく表示してくれなかった。

解決策

↓のようなかんじで、絶対パスで指定する必要がある。

before

<img
  src="images/hoge.png"
  alt="Hoge"
/>

after

<img
  src="/images/hoge.png"
  alt="After"
/>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0