@mixspa/react

0.6.3 • Public • Published

mixspa-react

Mixspa-React is a wrapper for mixspa-core.

Current Status:

NPM Version NPM Downloads Build Status

NPM

What it come from?

Pleas reference here: mixspa-core

Apis for this library

createApp: create a mixspa app.

import { createApp } from '@mixspa/react';
import { BrowserRouter } from 'react-router-dom';
import App from './App';

createApp(
  'app-tag',
  (props) => (
    <BrowserRouter baseName={ props.baseName }>
      <App />
    </BrowserRouter>
  )
);

AppLink: This link will send a event to event bus.

import { AppLink } from '@mixspa/react';

const NavBar = () => (
  <div>
    <AppLink to="/menu-a"/>
    <AppLink to="/menu-b"/>
  </div>
);

AppLoader: load a mixspa app.

import { AppLoader } from '@mixspa/react';

const Loading = () => <div>Loading...</div>

const Content = () => (
  <div>
    <AppLoader appId="appId" renderLoading={ () => <Loading /> }/>
  </div>
);

AppContainer: Receive event and handle url change event.

import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import { Route, Switch } from "react-router-dom";
import { AppContainer } from '@mixspa/react';

ReactDOM.render(
  <BrowserRouter>
    <AppContainer>
      <Switch>
        <Route path="/test-a"/>
        <Route path="/test-b"/>
      </Switch>
    </AppContainer>
  </BrowserRouter>,
  document.getElementById('app')
);

License

mixspa-react is released under the MIT license.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.6.30latest

Version History

VersionDownloads (Last 7 Days)Published
0.6.30
0.6.20
0.6.10
0.6.00
0.5.10
0.5.00
0.4.00
0.3.30
0.3.20
0.3.10
0.3.00
0.2.00
0.0.10

Package Sidebar

Install

npm i @mixspa/react

Weekly Downloads

0

Version

0.6.3

License

MIT

Unpacked Size

16.6 kB

Total Files

10

Last publish

Collaborators

  • xqcao