Skip to content

Replacing map with filter in an example #4801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2025
Merged

Conversation

kopeczech
Copy link
Contributor


name: 📝 Documentation Fix
about: A small fix in an example code

What docs page needs to be fixed?

  • Section: Using Redux
  • Page: Deriving Data with Selectors

What is the problem?

Example code snippet uses the map method in a place where filter method should be used instead.

function TodoList() {
  // highlight-start
  // ❌ WARNING: this _always_ returns a new reference, so it will _always_ re-render!
  const completedTodos = useSelector(state =>
    state.todos.map(todo => todo.completed)
  )
  // highlight-end
}

What changes does this PR make to fix the problem?

map has been replaced with filter

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

netlify bot commented Jul 20, 2025

Deploy Preview for redux-docs ready!

Name Link
🔨 Latest commit 905ca07
🔍 Latest deploy log https://app.netlify.com/projects/redux-docs/deploys/687cdacad7c944000804741f
😎 Deploy Preview https://deploy-preview-4801--redux-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@EskiMojo14 EskiMojo14 merged commit 217a290 into reduxjs:master Jul 20, 2025
5 checks passed
@EskiMojo14
Copy link
Contributor

thanks!

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.

2 participants