简体   繁体   English

'Component' 未定义 no-undef 搜索关键字以了解有关每个错误的更多信息

[英]'Component' is not defined no-undef Search for the keywords to learn more about each error

App.js应用程序.js

import React from 'react';

import './App.css';

import UserInput from './USerInput/UserInput';
import UserOutput from './UserOutput/UserOutput';

class App extends Component {
  render() {
    return (
      <div className="App">
        <p>Somekind of text </p>
        <userInput />
         <userOutput />
      </div>


    );
  }
}
export default App;

UserInput.js用户输入.js

import React from 'react';
import './App.css';

const userInput = () => {

return <input type="text" />
};

export default userInput;

Output.js输出.js

import React from 'react';
import './App.css';

const userOutput = () => {

return <input type="text" />
};

export default userOutput;


Error is in * USerOutput.js * could not be properly linked with src as it dims code line in VSCode too and the below component error错误在 * USerOutput.js * 无法与 src 正确链接,因为它也会使 VSCode 中的代码行变暗,并且出现以下组件错误

./src/App.js
  Line 10:19:  'Component' is not defined  no-undef
Search for the keywords to learn more about each error.

*'Component' is not defined no-undef Search for the keywords to learn more about each error and previously * this ** Module not found: Can't resolve './App.css' in 'C:\\Users\\hp\\Desktop\\Reactjs\\exercise\\src\\User Output'** *'Component' 未定义 no-undef 搜索关键字以了解有关每个错误和以前的更多信息 * 此 ** 找不到模块:无法解析 'C:\\Users\\hp\\ 中的 './App.css'桌面\\Reactjs\\exercise\\src\\用户输出'**

Because of the line of class App extends Component in App.js you need to import Component also.由于App.js 中的class App extends Component这一行,您还需要导入Component

Just like the following:就像下面这样:

import React, { Component } from 'react';

I hope this helps!我希望这有帮助!

import React, { Component } from 'react'; import React, { Component } from 'react';

import this package in top.在顶部导入这个包。 And I hope it'll work我希望它会奏效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 src\components\cards.js Line 75:68: 'index' is not defined no-undef 搜索关键字以了解有关每个错误的更多信息 - src\components\cards.js Line 75:68: 'index' is not defined no-undef Search for the keywords to learn more about each error React js:./src/App.js第22行:未定义&#39;lastWinner&#39;no-undef搜索关键字以了解有关每个错误的更多信息 - React js: ./src/App.js Line 22: 'lastWinner' is not defined no-undef Search for the keywords to learn more about each error 错误:“列表”未定义no-undef“ route”未定义no-undef - Error : 'list' is not defined no-undef 'route' is not defined no-undef React function - 未定义 no-undef - 组件集成 - React function - is not defined no-undef— component integration React:'p'未在组件文件中定义 no-undef - React: 'p' is not defined no-undef in component file 反应错误:“值”未定义,无未定义 - React error: 'values' is not defined, no-undef React 错误 - 'deleteNinja' 未定义 no-undef - React Error - 'deleteNinja' is not defined no-undef javascript 错误“电子邮件”未定义。[no-undef] - javascript error 'email' is not defined.[no-undef] 错误:'控制台未定义。 [no-undef] - 括号 - ERROR: 'console is not defined. [no-undef] - Brackets ReactJS:&#39;initState&#39; 未定义 no-undef 错误 - ReactJS: 'initState' is not defined no-undef error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM