Skip to content

Commit

Permalink
update readme to reflect SearchHeadlessProvider changes (#159)
Browse files Browse the repository at this point in the history
update readme wording now that `SearchHeadlessProvider` requires a `SearchHeadless` instance instead of directly passing in the credentials.
  • Loading branch information
yen-tt committed Sep 7, 2022
1 parent 34a77e6 commit 331292e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,19 @@ npm install @yext/search-headless-react

## Getting Started - `SearchHeadlessProvider`

Search Headless React includes an `<SearchHeadlessProvider />` component, which instantiates an SearchHeadless instance and makes it available to the rest of your app.
Search Headless React includes an `<SearchHeadlessProvider />` component, which takes in a `SearchHeadless` instance and makes it available to the rest of your app. `SearchHeadless` instance is created using `provideHeadless(...)` with the appropriate credentials:

```tsx
import { SearchHeadlessProvider } from '@yext/search-headless-react';
import { provideHeadless, SearchHeadlessProvider } from '@yext/search-headless-react';
import SearchBar from './SearchBar';
import MostRecentSearch from './MostRecentSearch';
import UniversalResults from './UniversalResults';

const searcher = provideHeadless(config);

function MyApp() {
return (
<SearchHeadlessProvider
apiKey='your api key'
experienceKey='your experience key'
locale='en'
>
<SearchHeadlessProvider searcher={searcher}>
{/* Add components that use Search as children */}
<SearchBar/>
<MostRecentSearch/>
Expand Down

0 comments on commit 331292e

Please sign in to comment.