Closed
Description
Changing the names of props based on number of stores subscribed to seems tricky.
Let's say I have a dumb component that takes a prop board
( { name: 'My Board' }
), which should come from boardStore
:
<Container stores={[boardStore]}
actions={{ addList }}>
{(props) => <Board {...props} /> }
</Container>
But because I only subscribed to one store, it gets flattened and the component only receives name
prop.
If I need to add a subscription to another store userStore
, the props change to:
{
boardStore: { name: 'My Board' },
userStore: ...,
fooStore: ... // (This actually includes data from all stores, not just subscribed.)
}
I think it would be simplest, if the data would never be flattened. Then I can always just do:
<Container stores={[boardStore]}
actions={{ addList }}>
{(props) => <Board board={props.boardStore} /> }
</Container>
Another way could be to pass another function or a map of functions to map the state from stores to
props, but I think I actually prefer the former because of its simplicity.
Metadata
Metadata
Assignees
Labels
No labels