3.1.1 • Published 1 year ago

vivy-router v3.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vivy-router

NPM Version License

A Vivy plugin to handle router based on connected-react-router.

Docs

Installation

Using npm:

$ npm install vivy vivy-router

Examples

Examples in repository

$ cd ./examples/[EXAMPLE_NAME]
$ npm run start

Example names:

Complete and real project example

Documentation

Basic usage

import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-vivy';
import {createBrowserHistory} from 'history';
import {renderRoutes} from 'react-router-config';

// Import Vivy
import Vivy from 'vivy';

// Import VivyRouter and ConnectedRouter
import VivyRouter, {ConnectedRouter} from 'vivy-router';

// Import component
import Root from 'path_to_your_Root_component';

// Import Vivy model
import yourVivyModel from 'path_to_your_vivy_model';

// Routes config
const routes = [{
    path: '/',
    component: Root
}];

// Create browser history
const history = createBrowserHistory();

// Create vivy
const vivy = Vivy();

// Apply router plugin
vivy.use(VivyRouter({
    history
}));

// Create store after configuration
const store = vivy.createStore();

// Register vivy models
store.registerModel(yourVivyModel);

render(
    <Provider store={store}>
        <ConnectedRouter history={history}>
            {renderRoutes(routes)}
        </ConnectedRouter>
    </Provider>,
    document.getElementById('app-container')
);
3.0.0-alpha.1

1 year ago

3.0.0-alpha.0

1 year ago

3.0.0-alpha.2

1 year ago

3.1.1

1 year ago

3.0.2

1 year ago

3.1.0

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.1

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.3.2

2 years ago

2.0.0

2 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.1.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago