Skip to content

Conversation

connor-ricks
Copy link

The docs don't currently showcase how to assign the default value for the parent.

@connor-ricks connor-ricks force-pushed the task/improve-shared-state-docs branch from c1d7642 to 95b8623 Compare August 15, 2025 20:18
@connor-ricks connor-ricks force-pushed the task/improve-shared-state-docs branch from 95b8623 to c5b0a86 Compare August 15, 2025 20:52
@stephencelis
Copy link
Member

@connor-ricks Thanks for taking the time. Our docs here are actually what we want to show, though. Typically (but not always) we find that it should be the parent's responsibility to initialize this state.

We'd be down to add docs to explain both ways, though. It's similar to @State in SwiftUI, where when a default is omitted the parent must pass it in, but a feature can also initialize and manage its own local state.

Are you interested in making those changes?

@connor-ricks
Copy link
Author

connor-ricks commented Sep 28, 2025

@connor-ricks Thanks for taking the time. Our docs here are actually what we want to show, though. Typically (but not always) we find that it should be the parent's responsibility to initialize this state.

We'd be down to add docs to explain both ways, though. It's similar to @State in SwiftUI, where when a default is omitted the parent must pass it in, but a feature can also initialize and manage its own local state.

Are you interested in making those changes?

Thanks @stephencelis. I appreciate that context! I think I agree that the docs as stands are probably okay and will help to avoid confusion to others. I'd be concerned that the additional docs my add swirl to first time users of Shared.

@connor-ricks connor-ricks deleted the task/improve-shared-state-docs branch October 5, 2025 13:33
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