Reactjs 组件返回为未定义
我要走了 ./src/App.js第37行:“输出”未定义/jsx no undef 但我看不出我的错误。我已经正确地导入了我能看到的输出,我也正确地导出了,我没有看到jsx语法中的任何错误,或者其他语法中的错误 App.jsReactjs 组件返回为未定义,reactjs,Reactjs,我要走了 ./src/App.js第37行:“输出”未定义/jsx no undef 但我看不出我的错误。我已经正确地导入了我能看到的输出,我也正确地导出了,我没有看到jsx语法中的任何错误,或者其他语法中的错误 App.js import React, { Component } from 'react'; import './App.css'; import axios from 'axios'; import Ouput from './Components/Output'; class
import React, { Component } from 'react';
import './App.css';
import axios from 'axios';
import Ouput from './Components/Output';
class App extends Component {
constructor(props) {
super(props);
this.state = {
paras: 4,
html: true,
text: ""
};
}
componentWillMount() {
this.getSampleText();
}
getSampleText() {
axios
.get(
"http://hipsterjesus.com/api?paras=" +
this.state.paras +
"&html=" +
this.state.html)
.then(response => {
this.setState({ text: response.data.text }, function() {
console.log(this.state);
});
})
.catch(error => {console.log(error);
});
}
render() {
return ( <div className="App">
<Output value={this.state.text} />
</div>
);
}
}
export default App;
import React,{Component}来自'React';
导入“/App.css”;
从“axios”导入axios;
从“/组件/输出”导入输出;
类应用程序扩展组件{
建造师(道具){
超级(道具);
此.state={
第4段,
是的,
案文:“”
};
}
组件willmount(){
这个.getSampleText();
}
getSampleText(){
axios
.得到(
"http://hipsterjesus.com/api?paras=" +
本州+
“&html=”+
this.state.html)
。然后(响应=>{
this.setState({text:response.data.text},function(){
console.log(this.state);
});
})
.catch(错误=>{console.log(错误);
});
}
render(){
报税表(
);
}
}
导出默认应用程序;
Output.js
import React, { Component } from 'react';
class Output extends Component {
constructor(props) {
super(props)
this.state = {
value: props.value
}
}
render() {
return (<div className="output">
{this.props.value}
</div>
)
}
}
export default Output
import React,{Component}来自'React';
类输出扩展组件{
建造师(道具){
超级(道具)
此.state={
价值:道具价值
}
}
render(){
返回(
{this.props.value}
)
}
}
导出默认输出
您在导入输出中缺少了一个t
。
应该是输出
非常感谢,我知道这是很愚蠢的事情,谢谢!