I am getting errors as specified below. i don't know where i am going wrong.please help me out. I have changed my webpack config also and i have also updated react-hot-webpack loader also but still i am getting these errors..
Thanks in advance.
these are the errors i am getting.
ERROR in ./~/redux-form/lib/reduxForm.js
Module not found: Error: Cannot resolve module 'react-redux' in /home/priyanka/Finalproject/node_modules/redux-form/lib
@ ./~/redux-form/lib/reduxForm.js 27:18-40
ERROR in ./~/redux-form/lib/values.js
Module not found: Error: Cannot resolve module 'react-redux' in /home/priyanka/Finalproject/node_modules/redux-form/lib
@ ./~/redux-form/lib/values.js 9:18-40
ERROR in ./~/redux-form/lib/ConnectedField.js
Module not found: Error: Cannot resolve module 'react-redux' in /home/priyanka/Finalproject/node_modules/redux-form/lib
@ ./~/redux-form/lib/ConnectedField.js 13:18-40
this is my react code
import { createStore, combineReducers } from 'redux'
import { reducer as formReducer } from 'redux-form'
import React, { Component } from 'react';
import { reduxForm } from 'redux-form';
const reducers = {
// ... your other reducers here ...
form: formReducer // <---- Mounted at 'form'
}
const reducer = combineReducers(reducers)
const store = createStore(reducer)
class ContactForm extends Component {
render() {
const { handleSubmit } = this.props;
return (
<form onSubmit={handleSubmit}>
<div>
<label>First Name</label>
<Field name="firstName" component={React.DOM.input} type="text"/>
</div>
<div>
<label>Last Name</label>
<Field name="lastName" component={React.DOM.input} type="text"/>
</div>
<div>
<label>Email</label>
<Field name="email" component={React.DOM.input} type="email"/>
</div>
<button type="submit">Submit</button>
</form>
);
}
}
// Decorate the form component
ContactForm = reduxForm({
form: 'contact' // a unique name for this form
})(ContactForm);
export default ContactForm;
and this is my webpack
module.exports = {
entry: './src/index.js',
output: {
path: __dirname + '/public',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.json$/,
loader: 'json-loader'
},
{ test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' },
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /(node_modules|lib\/ckeditor)/
},
{
test: /\.s?css$/,
loaders: ['style-loader','css-loader','sass-loader']
}
]
},
resolve: {
alias: { 'react/lib/ReactMount': 'react-dom/lib/ReactMount' }
}
};
Installation for redux persist:import { persistStore, persistReducer } from 'redux-persist'; For persistReducer is wrap your app's root reducers and pass it to the persistStore function it ensures your redux state is stored to persisted storage whenever it changes.
While Redux can be used with any UI layer, it was originally designed and intended for use with React. There are UI binding layers for many other frameworks, but React Redux is maintained directly by the Redux team.
npm install react-redux --save
This should solve the issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With