I am using react-router-dom 6.4.2.
The expected result:
When the user browses the link http://mysite/?search=123,
my website returns the search result of 123
,
Here is my App.js:
<Router>
<Routes>
<Route exact path='/?search=:keyword' element={<SearchEng />} />
<Route path='/' element={<Home />} />
</Routes>
</Router>
The actual result:
Unfortunately, when a user browses the link http://mysite/?search=123,
it always returns the Home
component.
Would you help to fix the problem?