1import { SearchBar } from 'react-native-elements';
2
3export default class App extends React.Component {
4 state = {
5 search: '',
6 };
7
8 updateSearch = (search) => {
9 this.setState({ search });
10 };
11
12 render() {
13 const { search } = this.state;
14
15 return (
16 <SearchBar
17 placeholder="Type Here..."
18 onChangeText={this.updateSearch}
19 value={search}
20 />
21 );
22 }
23}
1export default function App() {
2 // state variables defined
3
4 useEffect(() => {
5 setIsLoading(true);
6
7 fetch(API_ENDPOINT)
8 .then(response => response.json())
9 .then(response => {
10 setData(response.results);
11 setIsLoading(false);
12 })
13 .catch(err => {
14 setIsLoading(false);
15 setError(err);
16 });
17 }, []);
18 // ...
19}
20