Junctions: Routing You Can Follow.
Built for React, using the excellent history package.
Why use Junctions?
- It's reusable. No hard-coded URLs means truly reusable components.
- It's simple. Everything you need in only 4 functions and 4 methods.
- It's independent. Works great with React, but doesn't rely on it.
The best way to understand Junctions is to see it in action. With that in mind, the Junctions Website uses Junctions underneath the hood -- and logs relevant details to the console as you navigate. If you're viewing the website right now, open your developer console to take a look.
At minimum, you'll need the junctions package
npm install junctions --save
npm install react-junctions --save
Alternatively, use plain-ol' script tags with unpkg.
<script src="https://email@example.com/dist/junctions.js"></script> <script src="https://firstname.lastname@example.org/dist/index.js"></script>
But before starting, ask yourself -- do you really need a Router? The Introduction covers this, before introducing the three main concepts you'll use with Junctions.
The next step is practice. The Basics section of the Guide will walk you through using the most important tools which Junctions provides, finishing with a full Example.
Contributions are welcome, especially for the documentation.
To get the documentation running locally, you'll need to run
npm install in both the root directories and the site directory. This is because babel looks at the root
.babelrc when compiling the example files.
Once you've installed the dependencies, run
npm start from the
site directory, then open the browser at http://localhost:8080
npm install cd site npm install npm start