<分区>
我在 React 中有一个组件,我正在将其导入 index.js,但它给出了这个错误:
Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null
index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import Search_Bar from './components/search_bar';
const API_KEY = 'AIzaSyCnpDObOLiiqN87YKJKZ-cxzdAsvYD1F-U';
const App = () => {
return
(
<div>
<Search_Bar />
</div>
);
}
ReactDOM.render(<App />, document.querySelector('#root'));
组件:
import React from 'react';
const Search_Bar = () =>
{
return <input />;
};
export default Search_Bar;