Fixed Navbar state not updating on route change

This commit is contained in:
2018-05-16 17:35:03 +10:00
parent 52b48a135d
commit 455d77d0fb

View File

@ -22,6 +22,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import React from 'react'; import React from 'react';
import { withRouter } from 'react-router';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { NavLink } from 'react-router-dom' import { NavLink } from 'react-router-dom'
import PageBoundary from './../../page/PageBoundary'; import PageBoundary from './../../page/PageBoundary';
@ -57,7 +58,7 @@ class Navbar extends React.Component {
<NavbarLink to="/" title="home" exact /> <NavbarLink to="/" title="home" exact />
<NavbarLink to="/about" title="about" /> <NavbarLink to="/about" title="about" />
<NavbarLink to="/contact" title="contact" /> <NavbarLink to="/contact" title="contact" exact />
</nav> </nav>
</PageBoundary> </PageBoundary>
</section> </section>
@ -71,4 +72,4 @@ const mapStateToProps = function(state) {
} }
} }
export default connect(mapStateToProps)(Navbar); export default withRouter(connect(mapStateToProps)(Navbar));