php - Why is my React router not functioning correctly?

one text

Solution:

If you are getting the 404 from your web server that means:

  1. Dispatch onClick event in <a/> tag causes a page refresh and you server doesn't have any matching route:

I recommend you to use Link instead of <a/>, because it internally use history and also won't trigger a full page refresh while an <a /> tag naturally will:

Replace this:

 <a href={`/hotels/edit/${hotel.hotel_id}`}>Edit</a>

To this:

 <Link to={`/hotels/edit/${hotel.hotel_id}`}>Edit</Link>

Source