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.
There are also a number of live demos with source. Take a look at the Raw example to see how Junctions works without any React-specific helper components, or see Basic for a typical example.
At minimum, you'll need the junctions package
npm install junctions --save
If you want <Link> and <Router> components to help integrating with React, install react-junctions
npm install react-junctions --save
Alternatively, use plain-ol' script tags with unpkg.
<script src="https://unpkg.com/[email protected]/dist/junctions.js"></script>
<script src="https://unpkg.com/[email protected]/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