npm.io
0.1.6 • Published 5 years ago

srh-plugins-logger

Licence
MIT
Version
0.1.6
Deps
4
Size
12 kB
Vulns
0
Weekly
0
Stars
2

Srh-Plugins-Logger

Quick Start

import { srhLogger } from 'srh-plugins-logger'
import { createStore } from 'structured-react-hook'

const useStore = createStore(
  {
    initState: {name:''},
    service:{
      helloWorld(){
        this.rc.setName('hello world')
      }
    }
    controller: {
      onMount(){
        this.service.helloWorld()
      }
    }
  },
  [srhLogger]
)
function App(){
  const store = useStore()
  useEffect(()=>{
    store.controller.onMount()
  },[])
  return(
    <div>{store.state.name}</div>
  )
}

运行会输出如下 Logger

[Ctrl] onMount

[Service] helloWorld 'helloWorld'

[Reducer Case] setName '' → 'helloWorld'

Keywords