小编Dan*_*Kim的帖子

Webpack使用bootstrap - jquery没有定义

import $ from 'jquery';
require("./node_modules/bootstrap/dist/css/bootstrap.min.css")
require("./node_modules/bootstrap/js/dropdown.js")
import React from 'react';
import ReactDOM from 'react-dom';
var _ = require('lodash');
Run Code Online (Sandbox Code Playgroud)

请参考上面的设置.有些原因我从dropdown.js 得到错误说" Uncaught ReferenceError:jQuery未定义()"

我还在webpack.config.js中包含以下行

   plugins: [
    new webpack.NoErrorsPlugin({
        $: "jquery",
        jQuery: "jquery"
    })
]
Run Code Online (Sandbox Code Playgroud)

但是,没有运气 - 仍然有jQuery未定义的错误.任何的想法 ?有人可以帮忙解决这个问题吗?

非常感谢

jquery webpack

46
推荐指数
5
解决办法
4万
查看次数

styled-components表示在您的React组件(Component)周围包装了styled()

我在我的应用程序中使用样式组件在CodeSandbox中。请参考以下网址 https://lrn6vmq297.sse.codesandbox.io/

每当我进行一些更改时,控制台都会说。

Warning: Prop `className` did not match.

It looks like you've wrapped styled() around your React component (Component), but the className prop is not being passed down to a child. No styles will be rendered unless className is composed within your React component.

并且UI无法按预期呈现。有人知道我为什么遇到这个问题吗?请查看上面的网址。

谢谢

reactjs styled-components codesandbox

8
推荐指数
1
解决办法
4435
查看次数

React useEffect 方法上的箭头主体样式错误

这是我使用 React 的代码useEffect

    const [naked, setNaked] = useState(false);

    useEffect(() => {
        return () => setNaked(true);
    }, [props.onWatch]);

Run Code Online (Sandbox Code Playgroud)

由于某种原因,我遇到以下 eslint 错误:

 Unexpected block statement surrounding arrow body  arrow-body-style
Run Code Online (Sandbox Code Playgroud)

即使用括号括起来,仍然存在相同的问题:

    const [naked, setNaked] = useState(false);

    useEffect(() => {
        return () => {
          setNaked(true);
        }
    }, [props.onWatch]);

Run Code Online (Sandbox Code Playgroud)

有人有解决这个 eslint 错误的好主意吗?请 ?谢谢

reactjs eslint react-hooks

4
推荐指数
1
解决办法
2072
查看次数