-
Notifications
You must be signed in to change notification settings - Fork 66
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
Update reduxAsyncConnect state #100
Comments
Perhaps something like this: const mapStateToProps = (state) => {
return {
options: state.options,
data: state.selectedData
};
};
const mapDispatchToProps = (dispatch) => {
return {
fetchData: (id) => {
return dispatch(fetchData(id));
}
};
};
@asyncConnect([{
promise: ({store: {dispatch}) => {
// loadInitialView dispatches calls for all option ids and data for first option
return dispatch(loadInitialView());
}
}],
mapStateToProps,
mapDispatchToProps
)
export default class View extends React.Component {
render() {
const {options, data, fetchData} = this.props;
return (
<div>
<select onChange={/* call fetchData */}>
{options.map((option) => {
return <option value={option.id}>{option.text}</option>
})}
</select>
<div>{data}</div>
</div>
);
}
} |
Thank you for your help! ReduxAsyncConnect will store data in As another example, think of anything on the page that requires to refetch the data with new params from the server and update the view. Thank you! |
I might be wrong, but I don't think you can/should modify data in the So in the above code,
|
@dlakata is right, ideally you don't want to work with the state in the reduxAsyncConnect and in the future I would like to make a breaking change where we can completely remove any actual state saved to the reduxAsyncConnect except for boolean flags on loaded/unloaded keys & fixed filtering |
I have a question and basically looking for some suggestions on how to handle this situation, not sure if
redux-connect
is suitable.redux-connect
loads data usingid
as param from the dropdownWhat would be a good approach to implement this behavior? Ideally would be to rerun
redux-connect
as if user just got to the page, is it possible?Thank you for any suggestions!
The text was updated successfully, but these errors were encountered: