mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 17:45:59 +00:00
29404f087e
Summary: If the new state depends on the previous state, if I remember correctly, it’s safer to use `setState()` with a function argument to ensure we’re not reading from an outdated `state`. Thanks for submitting a PR! Please read these instructions carefully: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. The tutorial suggests to use `setState()` with an object argument when the new state depends on the previous state. In such situations, it’s preferable to use a function to ensure the previous state is up-to-date. Updates documentation only, so there are no additional tests. Rendering the site. Sign the [CLA][2], if you haven't already. Small pull requests are much easier to review and more likely to get merged. Make sure th Closes https://github.com/facebook/react-native/pull/13358 Differential Revision: D4852404 Pulled By: hramos fbshipit-source-id: 834759e16bcfbd5a8de71bf0c56f2b154f3321e1