Speed up your React Components with flattened states and React.PureComponent

added by JavaScript Kicks
8/10/2018 9:30:36 AM

527 Views

More often than not I see React Components written like this: class MyComponent extends React.Component { constructor(props) { this.state = { data: props.data /* Where data is an object */ }; } Nesting objects in the state make it difficult to detect if anything really did change in props.data.


0 comments