Skip to content

docs: clarify FlatList extraData prop and PureComponent behavior (fixes #5216) - #5282

Open
supunyasanthaofficial wants to merge 1 commit into
react:mainfrom
supunyasanthaofficial:fix/flatlist-extradata-example
Open

supunyasanthaofficial wants to merge 1 commit into
react:mainfrom
supunyasanthaofficial:fix/flatlist-extradata-example

Conversation

@supunyasanthaofficial

Copy link
Copy Markdown
Contributor

Summary

Fixes #5216.

Clarifies how extraData works in the selectable FlatList example in docs/flatlist.md. The change is also applied to the versioned docs from 0.77 through 0.87.

Changes

  • Explained that extraData tells FlatList when it needs to account for changes in data outside its data prop.
  • Clarified that FlatList uses shallow prop comparison, so extraData is important when renderItem doesn't change its reference but depends on external state.
  • Removed the ambiguous use of "we" to follow the documentation style guide.

Test Plan

  • Ran npx eslint docs/flatlist.md with no errors.
  • Checked formatting across the versioned docs from 0.77 through 0.87.

@meta-cla meta-cla Bot added the CLA Signed label Oct 14, 2026
@theprantadutta

Copy link
Copy Markdown
Contributor

I'd looked into #5216 earlier, so I checked this against the source: FlatList extends React.PureComponent (FlatList.js). So with a stable renderItem and unchanged data, the shallow prop check skips the re-render entirely, and extraData is what gets it through. The wording here is right.

It also corrects something in my comment on the issue: I tied the stable-renderItem case to strictMode, which was too narrow. strictMode just adds a second memoization layer on top, and the PureComponent check applies either way.

This is from reading the source, not a device run.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example showing need for FlatList extraData prop is misleading

2 participants