redux

Redux Form Material UI: Select with Nested Lists not working

…衆ロ難τιáo~ 提交于 2021-02-11 11:47:56
问题 I have a situation where I need to show grouped lists of items: https://v0.material-ui.com/#/components/list (Go to Nested Lists) Can redux-form Select field work with options as <ListItem /> instead of <MenuItem /> ? I can't select any item from the nested dropdown. Redux's onChange callback doesn't fire up. Here is the code: Form: <form> <Field name="camops" normalize={normalizeMultipleSelectValues} component={MySelectFormField} floatingLabelText="Item(s)" fullWidth multiple /> </form>

Redux Form Material UI: Select with Nested Lists not working

笑着哭i 提交于 2021-02-11 11:47:25
问题 I have a situation where I need to show grouped lists of items: https://v0.material-ui.com/#/components/list (Go to Nested Lists) Can redux-form Select field work with options as <ListItem /> instead of <MenuItem /> ? I can't select any item from the nested dropdown. Redux's onChange callback doesn't fire up. Here is the code: Form: <form> <Field name="camops" normalize={normalizeMultipleSelectValues} component={MySelectFormField} floatingLabelText="Item(s)" fullWidth multiple /> </form>

Calling an async redux action creator on form submission

和自甴很熟 提交于 2021-02-11 06:36:26
问题 In a typical React/Redux app it's pretty common to use redux-thunk and async action creators to trigger an AJAX request and dispatch actions on start/success/failure of this request. However, I can't find a way to integrate such a function with react-final-form. Its redux submission example is using react-redux-promise-listener which dispatches an action immediately, but does not let me call my async action creator. It is possible to integrate react-final-form with a redux app that uses an

Get route params inside actioncreator/selector?

霸气de小男生 提交于 2021-02-11 06:18:52
问题 Using redux router, In my components I have access to the params object with information about by URL. However, inside my actioncreators, I get the state through getState() , and thus the params props has not been injected. Is there a way around this? 回答1: to get access params in action creators, you should pass it: in component this.props.someAction(this.props.params) in action creator const someAction = (params)=>{ let {data} = params; .... } to get access params in selector, you should

Get route params inside actioncreator/selector?

心不动则不痛 提交于 2021-02-11 06:18:16
问题 Using redux router, In my components I have access to the params object with information about by URL. However, inside my actioncreators, I get the state through getState() , and thus the params props has not been injected. Is there a way around this? 回答1: to get access params in action creators, you should pass it: in component this.props.someAction(this.props.params) in action creator const someAction = (params)=>{ let {data} = params; .... } to get access params in selector, you should

How to generate filtered list using reselect redux based on static filtered values?

[亡魂溺海] 提交于 2021-02-11 06:10:09
问题 I am fetching news data from an API, in the app I need to show 3 lists. today news, yesterday news, article news. I think I should use redux reselect. However, all the examples I am visiting has a dynamic filter value (state filter) while I need data to be fileted statically (no state changes these filters) my state at the moment is {news : [] } How can I generate something like below using reselect {news: [], todayNews:[], yesterdayNews:[], articleNews: []} should I use reselect or I should

How to generate filtered list using reselect redux based on static filtered values?

跟風遠走 提交于 2021-02-11 06:08:34
问题 I am fetching news data from an API, in the app I need to show 3 lists. today news, yesterday news, article news. I think I should use redux reselect. However, all the examples I am visiting has a dynamic filter value (state filter) while I need data to be fileted statically (no state changes these filters) my state at the moment is {news : [] } How can I generate something like below using reselect {news: [], todayNews:[], yesterdayNews:[], articleNews: []} should I use reselect or I should

How to generate filtered list using reselect redux based on static filtered values?

空扰寡人 提交于 2021-02-11 06:08:22
问题 I am fetching news data from an API, in the app I need to show 3 lists. today news, yesterday news, article news. I think I should use redux reselect. However, all the examples I am visiting has a dynamic filter value (state filter) while I need data to be fileted statically (no state changes these filters) my state at the moment is {news : [] } How can I generate something like below using reselect {news: [], todayNews:[], yesterdayNews:[], articleNews: []} should I use reselect or I should

vue.js和vue-router和vuex快速上手知识

萝らか妹 提交于 2021-02-11 02:36:05
vue.js和vue-router和vuex快速上手知识 一直以来,认为vue相比react而言,学习成本会更低,会更简单,但最近真正接触后,发现vue的各方面都有做一些客户化的优化,有一些亮点,但也有一些很不顺手的地方,没有react的灵活度,但却有ng的方便性。要说vue和react哪个更适合做移动端,其实没有绝对的答案,喜欢就好。我希望能通过这篇文章能让大家迅速上手vue的全家桶。 本文的例子源码托管在github上,地址是 https://github.com/tianxiangbing/vue-demo 首先,我们用vue-cli搭一个vue的开发环境,目前vue-cli3.0也出来了,但使用者不多,中文文档也较少,更多配置都是vue.config.js里,这里配置是返回一个module,也是修改webpack的配置项,但其实还是很麻烦,这个不在本文主题内,省过... 1. 服务的搭建 安装vue-cli,建议安装2.x的版本,本文使用的是vue-cli3.0 npm install -g vue-cli 创建一个vue的项目,项目名称叫vue-demo vue create vue-demo 然后进入项目目录下执行安装依赖包 npm i 然后启动服务,执行命令 npm run serve ,你应该可以看到如下的结果: 看到这里,就算成功了,在浏览器中打开 http:/

React/redux: Not saving in state as intended

给你一囗甜甜゛ 提交于 2021-02-10 18:10:34
问题 I am building a review app. I am using json-server to do post request. My database looks like this [{ "id": 5, "name": "Tom Cruise", "image": "http://placeholder.pics/svg/300x200/000000", "title": "Hiring Manager", "employeeId": "22222222", "funFact": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",