@dxd/ashe
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.3 • Public • Published

CircleCI Version License

Ashe

Package with React component with hooks(as useState, useEffect, ...) wrapper for combining React with MobX. For documentation, see the MobX project. The package supports react with hooks only

Usage

  • npm i @dxd/ashe

  • store

import { observable, action } from 'mobx'

class Store {
  @observable a = 1

  @action.bound plus() {
    this.a += 1
  }
}

export default new Store()
  • Component

typescript

import * as React from 'react'
import { observer } from '../@dxd/ashe'
import x from './store'

const Example1: React.FunctionComponent = props => {
  const b = x.a + 1

  return (
    <>
      <p>hahaha{b}</p>
      <button onClick={x.plus}>++</button>
    </>
  )
}

Example1.displayName = 'Example1'

export default observer(Example1)

Examples

https://doxiaodong.github.io/ashe/index.html

Advance

  • You can find a DI in examples/store, which make stores testable

Readme

Keywords

none

Package Sidebar

Install

npm i @dxd/ashe

Weekly Downloads

1

Version

1.0.0-beta.3

License

MIT

Unpacked Size

6.81 kB

Total Files

9

Last publish

Collaborators

  • duxiaodong