WIP - add extractor, generate snippet_data
This commit is contained in:
33
node_modules/shallow-compare/README.md
generated
vendored
Normal file
33
node_modules/shallow-compare/README.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# shallow-compare
|
||||
|
||||
[](https://badge.fury.io/js/shallow-compare)
|
||||
|
||||
Stand alone shallowCompare for use in libraries that support shouldComponentUpdate
|
||||
|
||||
## API
|
||||
|
||||
`shallowCompare(instance, nextProps, nextState)`
|
||||
|
||||
- instance (_component instance_) - the component's instance (`this`)
|
||||
- nextProps (_object_) - the next props
|
||||
- nextState (_object_) - the next state
|
||||
|
||||
## Example
|
||||
```javascript
|
||||
class Foo extends Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = { color: 'blue' }
|
||||
}
|
||||
|
||||
shouldComponentUpdate (nextProps, nextState) {
|
||||
return shallowCompare(this, nextProps, nextState)
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<div>{this.state.color}</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user