react-mini-router | A minimal URL router for React.js | Frontend Framework library
kandi X-RAY | react-mini-router Summary
kandi X-RAY | react-mini-router Summary
A minimal URL router for React.js. The router provides a small React.js mixin that is easy to integrate into a root level component. It makes little to no demands on how you structure your application. Routes call methods instead of creating components directly. This makes async data loading outside of the child components straight forward (allowing them to remain stateless). This also makes server side rendering straight forward. The Router supports the HTML5 History API and Hash URLs. It requires no special components or markup. You can use regular anchor tags in your html markup to trigger navigation, or use the navigate util method to programmatically trigger routes. Its only dependencies are path-to-regexp, urllite and React >= 0.14.0. The complete browser build is 10kb minified and 4kb minified and gzipped. See the example app for a complete solution that includes server side rendering and integrates with Fluxxor for Store/Dispatch functionality. IMPORTANT If you require React 0.13 or earlier, please install version 1.1.7. Version 2.0.0 requires React 0.14 or newer.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-mini-router
react-mini-router Key Features
react-mini-router Examples and Code Snippets
Community Discussions
Trending Discussions on react-mini-router
QUESTION
I'm writing a single-page web application using React and Material UI, with React-Mini-Router
for routing. I have a drawer on the side that is activated by a hamburger icon in the top app bar. Each of the items in the drawer is a Material UI ListItem
that should navigate to their respective views when clicked. However, when the hamburger icon is clicked, it seems that all of the onClick
events are being triggered, and the view changes to that of the last item on the list. If I type in the correct url for a view I want to go to, it works, but clicking the buttons in the drawer does not redirect away from the last page in the list.
I've tried changing which item is last on the list, and the problem follows the last item (which is why I think they're all getting triggered consecutively). I've made sure that the event for the hamburger button only triggers the drawer state change. I've also noticed that when the page changes, it goes to something like http://localhost:3000/#!/help
instead of what I would expect to be http://localhost:3000/help
or http://localhost:3000/help#!/
This is the setup for my drawer list:
...ANSWER
Answered 2019-Jan-14 at 19:46You are executing ChangeView
on the component mount instead of binding the method to the click
event. Just rewrite those lines like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-mini-router
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page