Skip to content

Commit

Permalink
Removed unnecessary code in Libraries/Text/Text.js (#22132)
Browse files Browse the repository at this point in the history
Summary:
I don't think it's necessary to use spread properties (prevState) in `getDerivedStateFromProps`
Pull Request resolved: #22132

Differential Revision: D12929838

Pulled By: TheSavior

fbshipit-source-id: cdc4f9df8e2f0b2878aec605478144b3e08cea89
  • Loading branch information
ifsnow authored and facebook-github-bot committed Nov 5, 2018
1 parent f8040ed commit 0d4f627
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ class TouchableText extends React.Component<Props, State> {
responseHandlers: null,
};

static getDerivedStateFromProps(nextProps: Props, prevState: State): ?State {
static getDerivedStateFromProps(
nextProps: Props,
prevState: State,
): $Shape<State> | null {
return prevState.responseHandlers == null && isTouchable(nextProps)
? {
...prevState,
responseHandlers: prevState.createResponderHandlers(),
}
: null;
Expand Down

0 comments on commit 0d4f627

Please sign in to comment.