Skip to content

docs: clarify selectors usage in playground#285

Open
ncthuc2004 wants to merge 3 commits into
piotrwitek:masterfrom
ncthuc2004:issuehunt-109-selectors-in-playground
Open

docs: clarify selectors usage in playground#285
ncthuc2004 wants to merge 3 commits into
piotrwitek:masterfrom
ncthuc2004:issuehunt-109-selectors-in-playground

Conversation

@ncthuc2004

@ncthuc2004 ncthuc2004 commented May 18, 2026

Copy link
Copy Markdown

Closes #109

Clarifies selector usage in the playground by:

  • adding a "Selectors in Playground" subsection in the guide
  • updating hooks example to consume exported feature selectors
  • explicitly showing RootState -> feature-slice adaptation pattern

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md Outdated
import * as React from 'react';
import { FCCounter } from '../components';
import { increment } from '../features/counters/actions';
import { countersSelectors, increment } from '../features/counters';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
import { countersSelectors, increment } from '../features/counters';
import { countersSelectors } from '../features/counters';
import { increment } from '../features/counters/actions';

Comment thread README_SOURCE.md
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It appears that the updates made to the hooks example in README.md (around line 1085) were not applied to this file. Since README.md is typically generated from README_SOURCE.md, these changes might be lost in future updates. Please ensure both files are kept in sync.

@ncthuc2004

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selectors in the playground?

1 participant