Skip to content

Commit 92eb966

Browse files
yn5frostney
authored andcommitted
Fix bug in componentShouldUpdate causing the component never to update when children are strings and have changed (#16)
1 parent c790dd0 commit 92eb966

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/TypeWriter.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TypeWriter extends React.Component {
3939
}
4040

4141
shouldComponentUpdate(nextProps, nextState) {
42-
const children = this.props;
42+
const { children } = this.props;
4343
const nextChildren = nextProps.children;
4444
const childrenAreStrings = typeof children === 'string' && typeof nextChildren === 'string';
4545
// TODO Implement childrenChanged for non-string children as well

0 commit comments

Comments
 (0)