Giter Site home page Giter Site logo

rrrouter's Introduction

#What?! Another router for React?! Let's start with React - from official documentation:

What is React?

React is a declarative, efficient, and flexible JavaScript library for building user interfaces.

Composition

The key feature of React is composition of components. Components written by different people should work well together. It is important to us that you can add functionality to a component without causing rippling changes throughout the codebase.

Common Abstraction

We don't want to bloat your apps with useless library code.

Stability

We value API stability.

#So why? It's true that there are already dozen routers for React. It's sad, but there is no any implementation that respects React way: non-bloated, easy to extend, simple yet powerful, stable api.

To learn rrrouter you must know only 3 things:

  • Provider
  • Router
  • Route

But let's start from beginning...

#Architecture Architecture

As you can see:

  • There can be only one Provider with many Routers
  • Each Router can have multiply Routes

But let's describe purpose of each component.

Component Description
Provider Provides current route information and actions to mutate it. Will notify each Router about changes of current route. Only Routers work directly with Provider.
Router Groups Routes, provides methods for matching/testing hrefs, exposes current route and actions from Provider. Will notify each Route(if condition met) about changes. Any component that wants to get information about current route or mutate it, must use Router for it.
Route Renders a component or invokes a callback if condition met.

#TODO:

  • documentation
  • examples
  • tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.