I'm a beginner with React-Redux, and I had a question of how to use history and the Link tag in order to push to a certain location.
I wanted to be able to use history.push in my actions, so I used the history JS library. I created a history.js file in my app folder:
src/history.js
import { createBrowserHistory } from 'history';
export default createBrowserHistory();
I then imported the history object into my App.js, and had my routes placed within a Router tag with history:
src/App.js
<Router history={history}>
<Switch>
<Route path="/loginscreen" component={Loginscreen} />
<Route path="/login" component={Login} />
<Route path="/Property-Assistant-2018/profile" component={Profile} />
<Route path="/Property-Assistant-2018/properties" component={Property} />
<Route path="/Property-Assistant-2018/detail/:id" render={(props)=><PropertyDetail{...props}/>} />
<Route path="/Property-Assistant-2018/new_property" component={NewProperty} />
<Route path="/Property-Assistant-2018/register" component={Register} />
<Route path="/Property-Assistant-2018/contact" component={Message} />
<Route path="/Property-Assistant-2018/edit_property/:id" render={(props)=><EditProperty{...props}/>}/>
<Route path="/Property-Assistant-2018" component={Initial} />
</Switch>
However, now my Link tags in my nav bar do not work. When I click on them, they just stay at the inital homepage. I tried adding a second set of Switch routes, to see if I can hardcode it and figure out what was going on, but that made the homepage appear stacked on top of the Link route page.
src/App.js
<Link to="/Property-Assistant-2018/contact">Contact</Link>
So my question is, how can I use history and Link tags at the same time? I know history is included with React-Router v.4, and I've been using this, but I can't use it for my actions.
It's probably a simple fix, so thank you for helping me with this issue.