Skip to content

Instantly share code, notes, and snippets.

@ryanbelke
Last active May 5, 2020 00:00
Show Gist options
  • Select an option

  • Save ryanbelke/4ff801d367b4e4353a2b52bd209b1811 to your computer and use it in GitHub Desktop.

Select an option

Save ryanbelke/4ff801d367b4e4353a2b52bd209b1811 to your computer and use it in GitHub Desktop.
/pages/index.js
/* /pages/index.js */
import React, { useState } from "react";
import { Col, Input, InputGroup, InputGroupAddon, Row } from "reactstrap";
import RestaurantList from "../components/RestaurantList";
function Home() {
const [query, updateQuery] = useState("");
return (
<div className="container-fluid">
<Row>
<Col>
<div className="search">
<InputGroup>
<InputGroupAddon addonType="append"> Search </InputGroupAddon>
<Input
onChange={e => updateQuery(e.target.value.toLocaleLowerCase())}
value={query}
/>
</InputGroup>
</div>
<RestaurantList search={query} />
</Col>
</Row>
<style jsx>
{`
.search {
margin: 20px;
width: 500px;
}
`}
</style>
</div>
);
}
export default Home;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment