Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Pelz epelz

View GitHub Profile
View injectorPatternExample.ts
/**
* A "pure" component means that the render function only depends on props and state,
* which allows us to add performance optimizations (see `shouldComponentUpdate` below).
*/
class PureComponent<P, S> extends React.Component<P, S> {
shouldComponentUpdate(nextProps: P, nextState: S): boolean {
return !shallowEqual(this.props, nextProps) ||
!shallowEqual(this.state, nextState);
}
}
You can’t perform that action at this time.