Research Week!

import React from 'react';const SearchBar = () => (
<form action="/" method="get">
<label htmlFor="header-search">
<span className="visually-hidden">Search blog posts</span>
</label>
<input
type="text"
id="header-search"
placeholder="Search blog posts"
name="s"
/>
<button type="submit">Search</button>
</form>
);
export default SearchBar;
const { search } = window.location;
const query = new URLSearchParams(search).get('s');
const filterPosts = (posts, query) => {
if (!query) {
return posts;
}
return posts.filter((post) => {
const postName = post.name.toLowerCase();
return postName.includes(query);
});
};

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

flat() & flatMap() methods in Javascript

Discord Bot Development with Js!

Material Design Motions with React Native — Hello world

Type Checking using PropTypes in React

Find ABI code in 3 way

How to use Active Storage with React to store pictures

Creating Tabs using Angular Material 2 and Angular 4 Routing

CREATE AMAZON CLONE USING REACT JS🤷‍♂️🤷‍♂️ PART 2

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Parker Williamson

Parker Williamson

More from Medium

Oracle Trainee Program: My experience so far..

Cover page of the book Atomic habits by James Clear

Consider the value of a precedent (pronounced prĕs′ĭ-dənt)

Victorian Age and the Hypocrisies of their writers

What It Will Take to Prepare for Future Pandemics- CEPI CEO Shares Insights During Visit to Nigeria