byte-fe / react-model

The next generation state management library for React
236 stars 23 forks source link

Props dropped by connect decorator #61

Closed ArrayZoneYour closed 5 years ago

ArrayZoneYour commented 5 years ago
const Button = connect(
  'Counter',
  (props: any) => props
)(
  class extends React.PureComponent<any> {
    render() {
      const { state, actions, buttonName = '' } = this.props
      return (
        <button
          onClick={() => {
            actions.increment(3).catch((e: any) => console.error(e))
          }}
        >
          {buttonName}
          {state.count}
        </button>
      )
    }
  }
)
<Provider>
  <Button buttonName="button" />
</Provider>

expect(button!.textContent).toBe('button0')