Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 引导类在React组件中不起作用_Javascript_Reactjs_Webpack_Bootstrap 4 - Fatal编程技术网

Javascript 引导类在React组件中不起作用

Javascript 引导类在React组件中不起作用,javascript,reactjs,webpack,bootstrap-4,Javascript,Reactjs,Webpack,Bootstrap 4,我已经在我的React Componnet中导入了这样的引导风格 import 'bootstrap/dist/css/bootstrap.min.css'; 然后在我的组件中应用如下css样式: const Login = ({ store }) => { return ( <form> <div className="form-group"> <lab

我已经在我的React Componnet中导入了这样的引导风格

import 'bootstrap/dist/css/bootstrap.min.css';
然后在我的组件中应用如下css样式:

const Login = ({ store }) => {
    return (
            <form>
                <div className="form-group">
                    <label htmlFor="username">User Name</label>
                    <input type="text" id="username" onChange={e => store.updateUsername(e)} value={store.username} />
                </div>
                <div className="form-group">
                    <label htmlFor="password">Password</label>
                    <input type="password" id="password" onChange={e => store.updatePassword(e)} value={store.password} />
                    <input type="submit" value="Submit" disabled={store.disableSearch} />
                </div>
            </form>
    )}
我正在使用带有React 16的Webpack 4。
这里怎么了

您安装了引导程序吗?您可能需要重新加载dev服务器。工作正常。是的,我已经安装了npm引导程序,然后重新启动了开发服务器。
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const htmlPlugin = new HtmlWebpackPlugin({
    template: "./src/index.html",
    filename: "./index.html"
})

module.exports = {
    entry: './src/index.js',
    output: {
        path: path.resolve('dist'),
        filename: 'bundle.js',
        publicPath: '/'
    },
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                    options: {
                        sourceMap: true
                    }
                }
            },
            {
                test: /\.css$/,
                use: [
                    {
                        loader: "style-loader"
                    },
                    {
                        loader: "css-loader",
                        options: {
                            modules: true,
                            importLoaders: 1,
                            localIdentName: "[local]_[hash:base64]",
                            sourceMap: true,
                            minimize: true
                        }
                    }
                ]
            }
        ]
    },
    resolve: {
        extensions: ['.js', '.jsx'],
    },
    devServer: {
        historyApiFallback: true,
    },
    plugins: [htmlPlugin]
}