项目作者: co2-git

项目描述 :
Router for reactors
高级语言: JavaScript
项目地址: git://github.com/co2-git/reactors-router.git
创建时间: 2016-06-25T20:49:22Z
项目社区:https://github.com/co2-git/reactors-router

开源协议:

下载


reactors-router

Router for the Reactors framework.

Reactors is a framework based on React to build hybrid apps that run web, mobile and desktop.

Install

  1. yarn add react reactors reactors-router

Usage

  1. import React from 'react';
  2. import Router from 'reactors-router';
  3. import {View, Text} from 'reactors';
  4. export default function App() {
  5. return (
  6. <Router name="main" width={400} height={500}>
  7. <Router.Route name="page-a">
  8. <View>
  9. <Text>Page A</Text>
  10. <Text onPress={() => Router.get('main').go('page-b')}>Go to page B</Text>
  11. </View>
  12. </Router.Route>
  13. <Router.Route name="page-b">
  14. <View>
  15. <Text>Page B</Text>
  16. <Text onPress={() => Router.get('main').go('page-a')}>Go to page A</Text>
  17. </View>
  18. </Router.Route>
  19. </Router>
  20. );
  21. }

You can have as many routers as you want (included nested), provided you give them a name.