You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Coming from a ReduxJS/React background it is very common to pass multiple items from a redux store to a child component (e.g. using both mapStateToProps and mapDispatchToProps).
I have not seen in any example where you may want to pass both a state and a dispatcher to the same child component.
Is it considered correct to returning a tuple from a StoreConnector?
// Connect the Store to a FloatingActionButton. In this case, we'll// use the Store to build a callback that with dispatch an Increment// Action.//// Then, we'll pass this callback to the button's `onPressed` handler.
floatingActionButton:newStoreConnector<int, Tuple2<int, VoidCallback>>(
converter: (store) {
// Return a Tuple2 - one like mapStateToProps and one mapDispatchToProps// Return a `VoidCallback`, which is a fancy name for a function// with no parameters. It only dispatches an Increment action.returnnewTuple2(
store.state, () => store.dispatch(Actions.Increment));
},
builder: (context, tuple) {
returnnewFloatingActionButton(
// Attach the `callback` to the `onPressed` attribute
onPressed: tuple.item2,
tooltip:
tuple.item1.isOdd ?'Increment_ODD':'Increment_EVEN',
child:newIcon(Icons.add));
},
),
),
The text was updated successfully, but these errors were encountered:
Coming from a ReduxJS/React background it is very common to pass multiple items from a redux store to a child component (e.g. using both
mapStateToProps
andmapDispatchToProps
).I have not seen in any example where you may want to pass both a state and a dispatcher to the same child component.
Is it considered correct to returning a tuple from a
StoreConnector
?The text was updated successfully, but these errors were encountered: