From e0704b25907c0a50483599f0c54e9621a327ce8d Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Sun, 23 Oct 2016 14:41:37 +0200 Subject: [PATCH] Docs replace reference to 'getInitialState' with 'state' instance property in "Thinking in React" (#8059) --- docs/thinking-in-react.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/thinking-in-react.md b/docs/thinking-in-react.md index dfe4ceca..bad8c9b3 100644 --- a/docs/thinking-in-react.md +++ b/docs/thinking-in-react.md @@ -124,7 +124,7 @@ Let's run through this strategy for our application: * The common owner component is `FilterableProductTable`. * It conceptually makes sense for the filter text and checked value to live in `FilterableProductTable` -Cool, so we've decided that our state lives in `FilterableProductTable`. First, add a `getInitialState()` method to `FilterableProductTable` that returns `{filterText: '', inStockOnly: false}` to reflect the initial state of your application. Then, pass `filterText` and `inStockOnly` to `ProductTable` and `SearchBar` as a prop. Finally, use these props to filter the rows in `ProductTable` and set the values of the form fields in `SearchBar`. +Cool, so we've decided that our state lives in `FilterableProductTable`. First, add an instance property `this.state = {filterText: '', inStockOnly: false}` to `FilterableProductTable`'s `constructor` to reflect the initial state of your application. Then, pass `filterText` and `inStockOnly` to `ProductTable` and `SearchBar` as a prop. Finally, use these props to filter the rows in `ProductTable` and set the values of the form fields in `SearchBar`. You can start seeing how your application will behave: set `filterText` to `"ball"` and refresh your app. You'll see that the data table is updated correctly.