What is the difference between these Routes in react? Which one is correct and which one should I use?
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/about" element={<About />} />
<Route exact path="/blog" element={<Blog />} />
</Routes>
or
<Routes>
<Route exact path="/" component={Home} />
<Route exact path="/about" component={About} />
<Route exact path="/blog" component={Blog} />
</Routes>
>Solution :
Both of them works almost same, but the one use case I can think of, for using element rather than the component(as most people do) is that you can pass props via the element method(element={<Home your_props={"yay I can pass props!"} />}).
So to summarize, there’s no such correct or wrong way to do things in programming, it just depends upon your use case. If one was the wrong way, why would the developer keep it?
I hope I can help you decide which way to go.