I am developing a sample react-redux application using webpack
webpack.config.js
var path=require('path');
const webpack = require('webpack');
module.exports= {
entry : './src/app.js',
output : {
filename : 'bundle.js',
path : path.resolve(__dirname,'public')
},
watch: true,
module : {
rules : [
{
test :/\.js$/,
exclude: /node_modules/,
loader : 'babel-loader',
query : {
"presets": ["@babel/preset-env","@babel/preset-react"]
}
}
]
}
}
bookList.js
"use strict"
import React from 'react';
import {connect} from 'react-redux';
import { bindActionCreators } from 'redux';
import {getBooks} from '../../actions/booksAction';
import {Grid, Col, Row, Button} from 'react-bootstrap';
import bookItem from './bookItem';
class BooksList extends React.Component
{
componentDidMount(){
this.props.getBooks()
}
render()
{
const booksList = this.props.books.map((booksArr)=> {
return (
<Col xs={12} sm={6} md={4} key={booksArr.id}>
testing
</Col>
)
})
return (
<Grid>
{booksList}
</Grid>
)
}
}
function mapStateToProps(state){
// which data to pass to react component
return{
books: state.books.books
}
}
function mapDispatchToProps(dispatch){
return bindActionCreators({getBooks:getBooks}, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(BooksList);
index.html (main page where grid also will load)
<html>
<head>
<title>
Hello Redux
</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
</head>
<body>
<div id="root"></div>
</body>
<script src="bundle.js"></script>
</html>
error bundle.js:9 Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. (bundle.js:9)
I already installed bootstrap, should i need to write anything in webconfig? Can anyone resolve my issue
I have tried to add 'style-loader','css-loader' in presets of webconfig.js but giving error