0.0.4 • Published 9 years ago
arcjs v0.0.4
arcjs
Easy to build front-end app.
Install
npm install --save arcjsUsage
use()mount plugin.mixin()mixin store and css module.render()render component with mixin assets.router()set react routes.run()react-dom rendering.
Basic
import Arc from 'arcjs'
import Store from './index.st'
import styles from './index.css'
const app = new Arc()
app.mixin(Store, styles)
app.render(({ children }, { store }) => {
return (
<div>Hi, this is an app.</div>
)
})Plugin
app.use((ctx, app) => {
// ctx will be passed to component
ctx.hi = 'hello guys'
})
app.use((ctx, app) => {
// add app singleton
app.hi = (text) => {
ctx.halo = text
}
})
app.hi('halo')
// component(props, ctx)
app.render(({ children }, { hi, halo }) => {
return (
<div>{hi}, {halo}</div>
)
})