Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@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.

Install

npm i @mixspa/react

DownloadsWeekly Downloads

2

Version

0.6.3

License

MIT

Unpacked Size

16.6 kB

Total Files

10

Last publish

Collaborators

  • avatar