我已经在Web应用程序中使用了Redux表单,其中向导表单运行良好。一旦我添加了redux,向导表单就会显示一个奇怪的行为。当我在第一个表格中输入详细信息并移至下一个表格时,即使在提交数据之前,它也会更早显示验证部分。 同样,当我按上一个按钮时,它会删除一些数据。 有人遇到过这样的问题吗?如果可以的话,请您帮我一下。预先感谢!
或者是否可以将reduxpersist中的表单列入白名单
Redux表单:
export default reduxForm({
form: 'userForm',
destroyOnUnmount: false,
forceUnregisterOnUnmount: true,
validate
})(UserPersonalDetailForm);
坚持:
import { createStore, applyMiddleware } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
const middleware = applyMiddleware(thunk);
const store = createStore(persistedReducer, middleware);
let persistor = persistStore(store);
export {store, persistor};
Root.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { Provider } from 'react-redux';
import {store} from './redux/store';
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root'));
registerServiceWorker();