【发布时间】:2021-05-15 00:21:43
【问题描述】:
render(){
return (<div>
<form>
<input type='textarea' placeholder='enter city'/>
<br/>
<div className='temp'>
<input className='Fahren' type='radio'/>
<label for='temp'>Fahrenheit</label>
<input className='Celc' type='radio'/>
<label for='temp'>Celcuis</label>
</div>
<br></br>
<Search/>
<button type='submit'>Get Forecast</button>
</form>
</div>);
}
};
export default App;
上面的代码在我写返回时工作正常(带有整个代码)但是当我尝试使用渲染时它抛出一个错误“语法错误:/Users/Deeksha/Documents/reactandnodejs/weather-app/src/Components/App .js:缺少分号 (7:8)"
【问题讨论】:
-
函数组件中不需要渲染函数。直接返回你的jsx。
-
render仅用于类组件。 -
全部在文档中:reactjs.org/docs/…
标签: reactjs components