brains
v1.1.3
Published
React Framework
Downloads
52
Readme
brains
react 应用注册及启动
use
// App.tsx
import { Route, Switch } from 'legions/router';
import React from 'react';
export default class App extends React.Component {
render() {
return (
<Switch>
<React.Fragment>{this.props.children}</React.Fragment>
</Switch>
);
}
}
// 入口文件 main.ts
import create from 'brains';
import App from './App';
import { createHashHistory, createBrowserHistory, createMemoryHistory } from 'history';
const app = create(options);
app.start(App, '#react-app');
options
- enableDevTools : boolean
开启mobx 调试插件
- history : createHashHistory|createBrowserHistory|createMemoryHistory
路由类型,默认createHashHistory
- router : boolean
是否开启路由,此参数多余,历史原因考虑不周,逐步废弃,传入即可,不必过分关注
Licensing
MIT license