docs: clarify selectors usage in playground#285
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'Selectors in Playground' section to the documentation and updates code examples to utilize selectors instead of direct state access. Feedback highlights a compilation error caused by an incorrect import of the increment action creator in both the README and the hooks example. Additionally, it was noted that the code example updates in README.md were not synchronized with README_SOURCE.md.
| import * as React from 'react'; | ||
| import { FCCounter } from '../components'; | ||
| import { increment } from '../features/counters/actions'; | ||
| import { countersSelectors, increment } from '../features/counters'; |
There was a problem hiding this comment.
The increment action creator is not exported as a named export from the feature index (../features/counters). It is exported within the countersActions namespace. Importing it this way will cause a compilation error. You should either import it directly from the actions file or use the countersActions namespace.
| import { countersSelectors, increment } from '../features/counters'; | |
| import { countersSelectors } from '../features/counters'; | |
| import { increment } from '../features/counters/actions'; |
| import * as React from 'react'; | ||
| import { FCCounter } from '../components'; | ||
| import { increment } from '../features/counters/actions'; | ||
| import { countersSelectors, increment } from '../features/counters'; |
There was a problem hiding this comment.
The increment action creator is not a named export of ../features/counters. It is exported as part of the countersActions namespace. This import will fail at runtime/compile-time. To fix this without changing the usage on line 9, you can split the imports.
| import { countersSelectors, increment } from '../features/counters'; | |
| import { countersSelectors } from '../features/counters'; | |
| import { increment } from '../features/counters/actions'; |
| Check out our Playground Project located in the `/playground` folder. It contains all source files of the code examples found in the guide. They are all tested with the most recent version of TypeScript and 3rd party type-definitions (like `@types/react` or `@types/react-redux`) to ensure the examples are up-to-date and not broken with updated definitions (It's based on `create-react-app --typescript`). | ||
| > Playground project was created so that you can simply clone the repository locally and immediately play around with all the component patterns found in the guide. It will help you to learn all the examples from this guide in a real project environment without the need to create complicated environment setup by yourself. | ||
|
|
||
| ### Selectors in Playground |
There was a problem hiding this comment.
|
Addressed review points in the latest push:\n- hooks example now imports increment from ../features/counters/actions\n- selector usage remains via countersSelectors from the feature index\n- regenerated README.md from source/playground to keep docs in sync\n\nLatest commit is on issuehunt-109-selectors-in-playground. |
Closes #109
Clarifies selector usage in the playground by:
IssueHunt Summary
Referenced issues
This pull request has been submitted to: