React State of Routing

Created by Andrii Malaman

Andrii Malaman

Inputs

  • E-commerce web project
  • SEO is important
  • SPA application
  • React as a View
  • Is react-router a good choice for every project?
  • Are there good alternatives available?

Assesment metrics

  • Forks
  • Watchers
  • Stars
  • Age
  • Pull Requests
  • Refactoring (%)
  • Releases
  • Bus factor (%)
  • NPM downloads last month

https://github.com/zats/github_bus_factor

Refactoring (%)

Balance between added and deleted code. Crude value not including semantic understanding of the code.

Bus factor (%)

Will the project fail if this member is hit by the bus?

React-router

Metric Value
🍴 3855 forks.
🔭 651 watchers.
🌟 16896 stars.
🗓 Created over 2 years ago;
🍻 1141 PRs: 99.47% PRs are closed.
🛠 Deletions to additions ratio: 95.68%
📦 100 releases; latest release "v4.0.0-alpha.4"
🚌 Bus factor: 50.0% (2 impactful contributors).
📃 1m download last month

Some react-router facts

  • Originally inspired by the Ember router
  • Three major versions under active development simultaneously
  • 8 releases with breaking changes during last 2 years
  • Creators make money by selling trainings

react-router v1

  • Out of support
  • First Production ready release: November 2015 (1.0.0)
  • Last release: December 2015 (1.0.3)

react-router v2

  • The most popular routing library for react
  • UI routing (route to component matching)
  • Route hooks (onEnter, onChange, onLeave)
  • Central routing configuration is possible
  • Redux bindings

react-router v3

  • Remove all deprecated functionality of v2
  • Support history v3 instead of history v2
  • Add router to property for route components

react-router v4

  • Start of development: June 2016
  • Complete rewrite
  • Current release: v4.0.0-alpha.6
  • Should work with react-native
  • No route hooks
  • No central route config

universal-router

Metric Value
🍴 35 forks.
🔭 11 watchers.
🌟 342 stars.
🗓 Created over 1 year ago;
🍻 38 PRs: 92.11% PRs are closed
🛠 Deletions to additions ratio: 57.46%
📦 10 releases
🚌 Bus factor: 100% (1 contributor).
📃 8.694 downloads last month

react-enroute

  • github.com/tj/react-enroute
  • Small react wrapper around enroute package
  • No legacy browser support
  • Size: ~5k (~800% smaller than react-router)
Metric Value
🍴 25 forks.
🔭 23 watchers.
🌟 1256 stars.
🗓 Created 5 month ago;
🍻 4 PRs: 75.0% PRs are closed
🛠 Deletions to additions ratio: 20.83%
📦 2 releases
🚌 Bus factor: 100% (1 contributor).
📃 304 downloads last month

react-router-component

Metric Value
🍴 97 forks.
🔭 28 watchers.
🌟 794 stars.
🗓 Created almost 3 years ago
🍻 65 PRs: 90.77% PRs are closed
🛠 Deletions to additions ratio: 59.41%
📦 82 releases
🚌 Bus factor: 50.0% (2 impactful contributors)
📃 4.249 downloads last month

SUMMARY

  • react-router is "de facto" routing standart for react
  • react-router v4 is complete rewrite
  • For some projects it is worth to look for routing alternatives
https://malaman.github.io/talks/2016-react-state-of-routing