@samitouri / QOS-React / commits / 74026fd9ea

Docs replace reference to 'getInitialState' with 'state' instance property in "Thinking in React" (#8059)

Giuseppe committed Oct 23, 2016 at 14:41 UTC 74026fd9eac87fc15632a840edf486f338c696f9
1 file changed +1 -1
docs/docs/thinking-in-react.md
+1 -1
@@ -124,7 +124,7 @@ Let's run through this strategy for our application:
124 * The common owner component is `FilterableProductTable`.
125 * It conceptually makes sense for the filter text and checked value to live in `FilterableProductTable`
126
127 -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`.
127 +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`.
128
129 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.
130