3.0.0 • Published 2 months ago

@rcp/hoc.uncontrolled v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
2 months ago

@rcp/hoc.uncontrolled

NPM version NPM Downloads

The high order component for creating uncontrolled component

Installation

npm install @rcp/hoc.uncontrolled
# or use yarn
yarn add @rcp/hoc.uncontrolled

Usage

import uncontrolled from '@rcp/hoc.uncontrolled'

// `props.defaultValue` and `props.value`
// could be assigned to `this.state.value` in `constructor` and `componentWillReceiveProps` automatically.
@uncontrolled(['value'])
class Input extends React.Component {
  render() {
    return <input value={this.state.value} />
  }
}

API

uncontrolled

Parameters

  • propList {Prop[]} eg. ['value'] / [{ name: 'value', withDefault: false, eq: (a, b) => a === b }]

Returns Function (Component: React.ComponentClass) => React.ComponentClass

Related

Authors

This library is written and maintained by imcuttle, moyuyc95@gmail.com.

License

MIT

3.0.0

2 months ago

2.1.12

2 years ago

2.1.11

3 years ago

2.1.10

3 years ago

2.1.9

3 years ago

2.1.6

4 years ago

2.1.8

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago