Mixspa-preact is a wrapper for mixspa-core.
Pleas reference here: mixspa-core
import { createApp } from '@mixspa/preact';
import { BrowserRouter } from 'preact-router-dom';
import App from './App';
createApp(
'app-tag',
(props) => (
<BrowserRouter baseName={ props.baseName }>
<App />
</BrowserRouter>
)
);
import { AppLoader } from '@mixspa/preact';
const Loading = () => <div>Loading...</div>
const Content = () => (
<div>
<AppLoader appId="appId" loading={ Loading }/>
</div>
);
import { EventLink } from '@mixspa/preact';
const NavBar = () => (
<div>
<EventLink to="/menu-a"/>
<EventLink to="/menu-b"/>
</div>
);
import preactDOM from 'preact-dom';
import { BrowserRouter } from 'preact-router-dom';
import { Route, Switch } from "preact-router-dom";
import { EventHolder } from '@mixspa/preact';
preactDOM.render(
<BrowserRouter>
<EventHolder>
<Switch>
<Route path="/test-a"/>
<Route path="/test-b"/>
</Switch>
</EventHolder>
</BrowserRouter>,
document.getElementById('app')
);
mixspa-preact is released under the MIT license.