Skip to content

Commit 3b10e28

Browse files
Caleb Kemperalfonsogarciacaro
authored andcommitted
Changing 'setState' to 'this.setState' in the setState(s: 'S) Obsolete message to be more explicit.
1 parent ec3eabb commit 3b10e28

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Fable.React/Fable.Import.React.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ module React =
9191
/// Think of setState() as a request rather than an immediate command to update the component. For better perceived performance, React may delay it, and then update several components in a single pass. React does not guarantee that the state changes are applied immediately.
9292
/// setState() does not always immediately update the component. It may batch or defer the update until later. This makes reading this.state right after calling setState() a potential pitfall. Instead, use componentDidUpdate or a setState callback (setState(updater, callback)), either of which are guaranteed to fire after the update has been applied. If you need to set the state based on the previous state, read about the updater argument below.
9393
/// setState() will always lead to a re-render unless shouldComponentUpdate() returns false. If mutable objects are being used and conditional rendering logic cannot be implemented in shouldComponentUpdate(), calling setState() only when the new state differs from the previous state will avoid unnecessary re-renders.
94-
[<Obsolete("This overload is unsafe because it forces use of this.state. Use setState(updater: 'S->'P->'S) instead.")>]
94+
[<Obsolete("This overload is unsafe because it forces use of this.state. Use this.setState(updater: 'S->'P->'S) instead.")>]
9595
[<Emit("$0.setState($1)")>]
9696
member x.setState(value: 'S): unit = x.state <- value
9797

0 commit comments

Comments
 (0)