arcjs
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

arcjs

Easy to build front-end app.

Install

npm install --save arcjs

Usage

  • 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>
  )
})

Readme

Keywords

Package Sidebar

Install

npm i arcjs

Weekly Downloads

8

Version

0.0.4

License

MIT

Last publish

Collaborators

  • tvrcgo