小编Rap*_*ael的帖子

找不到模块:错误:无法解析“/app/node_modules/next/dist/lib”中的“pnpapi”

我尝试构建我的 next.js 应用程序并遇到了这个错误,它破坏了我的应用程序。

找不到模块:错误:无法解析“/app/node_modules/next/dist/lib”中的“pnpapi”

> Build error occurred
Error: > Build failed because of webpack errors
   at build (/app/node_modules/next/dist/build/index.js:15:918)
   at process._tickCallback (internal/process/next_tick.js:68:7
Run Code Online (Sandbox Code Playgroud)

reactjs webpack next.js

6
推荐指数
1
解决办法
609
查看次数

我如何在反应中取消订阅

我在代码中收到此警告以显示轮播。 警告:无法对卸载的组件执行 React 状态更新。这是一个空操作,但它表明您的应用程序中存在内存泄漏。要修复,请取消 componentWillUnmount 方法中的所有订阅和异步任务。

我尝试使用 componentWillUnmount 取消订阅,但警告仍然存在。下面是我的代码。

    constructor(props) {
        super(props);
        const idxStart = 0;
        this.state = {
            current: idxStart,
            prev: this.getPrevIndex(idxStart),
            next: this.getNextIndex(idxStart),
            Text: Text
        };
        // To disable autoplay, change to false 
        this.autoPlay = true;
    }

    getPrevIndex = (idx) => {
        if (idx <= 0) {
            return pics.length - 1;
        }
        return idx - 1;
    }

    getNextIndex = (idx) => {
        if (idx >= pics.length - 1) {
            return 0;
        }
        return idx + 1;
    }

    setIndexes …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

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

标签 统计

reactjs ×2

javascript ×1

next.js ×1

webpack ×1