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)">
是不是你的函数应该被称为App与适当的函数结构?
function App (){
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;
或
const App = props => (
<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;
看起来像语法错误