return (
<>
<nav className="navigation">
<div className="nav-items">
<h1 className="website-title">Where in the World?</h1>
<button className="theme-button">Dark Mode</button>
</div>
</nav>
<main className="main-container">
<Routes>
<Route path="/" element={<RenderCountries />} />
<Route path="/country/:id" element={<CountryPage />} />
</Routes>
</main>
</>
);
}
``` making the form input lag
#Hi guys ! I am having issues with React Form and Router !
13 messages · Page 1 of 1 (latest)
(the form comes from RenderCountries)
return (
<form>
<input
value={searchByCountry}
type="text"
placeholder="search for a country"
onChange={(e) => setSearchByCountry(e.target.value)}
/>
</form>
);
}
``` when that is alone everything works just fine !
huh it seems that instead of updating the component element={} re-creates it
I haven't found a solution to it and I'm going to bed, if anyone comes here and has a solution please leave it here I'll read it with pleasure tomorrow ❤️
Huge input lag? What does it imply? I don't understand.
You do not need to wrap the arrow function around the event handler. The event is automatically passed to the handler function.
I will take a little video of it cause it makes way more sense
But it’s like every time I write something in the form the component unmount then re mount
Instead of updating ?
@willow pike would you be able to share a repo or sandbox with us? We need to see more of your code to help you out.
Indeed !
Web site created using create-react-app