0.0.3 • Published 4 years ago

ello-routes-react v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

ello-routes-react

This pacakge provides react routes management for public routes and private routes.

NPM JavaScript Style Guide

Install

npm install --save ello-routes-react

Usage

import React, { Component } from "react";

import EllocentRouter from "ello-routes-react";
import Login from "..path/to/home/page/component";
import Signup from "..path/to/home/page/component";
import HomePage from "..path/to/home/page/component";

class Example extends Component {
  isLoggedIn = () => {
    if (condition) return true;
    else return false;
  };

  render() {
    return (
      <EllocentRouter
        PublicRoutes={[
          {
            path: "/",
            page: Login
          },
          {
            path: "/signup",
            page: Signup
          }
        ]} // Array of route objects
        SecuredRoutes={[{ path: "app/home", page: HomePage }]} // Array of route objects
        SecurityLogic={this.isLoggedIn}
        CommonData={{
          foo: "value",
          bar: "value",
          ...
        }} // any data you want to pass to all routes as props
      />
    );
  }
}

License

MIT © CodeLover12

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago