Skip to content

Commit d3e9650

Browse files
jasonboscoNikhiladiga
authored andcommitted
Tweaks
1 parent 9b81232 commit d3e9650

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

docs-site/content/guide/react-native-search-bar.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Building a Search Bar in React Native
22

3-
This guide walks you through building a mobile search interface using React Native (Expo) and Typesense. You'll create a cross-platform book search application that works on both iOS and Android devices, demonstrating how to integrate Typesense into your React Native projects. With over 60% of web traffic now coming from mobile devices, building fast and responsive mobile apps isn't just nice to have, it's essential. Mobile users expect instant results and won't wait around for slow searches. That's why combining React Native's native performance with Typesense's lightning-fast search engine creates the perfect foundation for a mobile app that your users will love.
3+
This guide walks you through building a native mobile search interface using React Native (Expo) and Typesense.
4+
5+
You'll create a cross-platform book search application that works on both iOS and Android devices, demonstrating how to integrate Typesense into your React Native projects.
6+
7+
Mobile users expect instant results and won't wait around for slow searches. That's why combining React Native's native performance with Typesense's lightning-fast search engine creates the perfect foundation for a mobile app search experience that your users will love.
48

59
## What is Typesense?
610

@@ -91,17 +95,17 @@ curl "http://localhost:8108/collections" \
9195
-H "Content-Type: application/json" \
9296
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
9397
-d '{
94-
"name": "books",
95-
"fields": [
96-
{"name": "title", "type": "string", "facet": false},
97-
{"name": "authors", "type": "string[]", "facet": true},
98-
{"name": "publication_year", "type": "int32", "facet": true},
99-
{"name": "average_rating", "type": "float", "facet": true},
100-
{"name": "image_url", "type": "string", "facet": false},
101-
{"name": "ratings_count", "type": "int32", "facet": true}
102-
],
103-
"default_sorting_field": "ratings_count"
104-
}'
98+
"name": "books",
99+
"fields": [
100+
{"name": "title", "type": "string", "facet": false},
101+
{"name": "authors", "type": "string[]", "facet": true},
102+
{"name": "publication_year", "type": "int32", "facet": true},
103+
{"name": "average_rating", "type": "float", "facet": true},
104+
{"name": "image_url", "type": "string", "facet": false},
105+
{"name": "ratings_count", "type": "int32", "facet": true}
106+
],
107+
"default_sorting_field": "ratings_count"
108+
}'
105109
```
106110

107111
Now that the collection is set up, we can load the sample dataset.
@@ -155,7 +159,7 @@ Let's go over the key dependencies:
155159
- **typesense-instantsearch-adapter** - Connects InstantSearch with Typesense
156160

157161
:::tip Note
158-
React Native can use `react-instantsearch-core` with the `typesense-instantsearch-adapter`, just like web frameworks. This gives you access to powerful InstantSearch hooks and widgets. Alternatively, you can make direct API calls to Typesense using the Fetch API for a lighter implementation.
162+
React Native can use `react-instantsearch-core` with the [`typesense-instantsearch-adapter`](https://github.com/typesense/typesense-instantsearch-adapter), just like web frameworks. This gives you access to powerful InstantSearch hooks and widgets. Alternatively, you can make direct API calls to Typesense using the Fetch API for a lighter implementation.
159163
:::
160164

161165
## Project Structure
@@ -227,9 +231,7 @@ Let's create the project structure step by step. After each step, we'll show you
227231
Expo automatically loads environment variables starting with `EXPO_PUBLIC_` and makes them available to your app via `process.env`.
228232
:::
229233

230-
Using env variables is **NOT recommended** for production apps since they are bundled with the app and can be reverse engineered. If you must use a key on the client side, ensure it has restricted permissions (read-only only) and limited scope.
231-
232-
For production, consider using a more secure method like a backend service behind an authentication layer to handle the API key.
234+
Using env variables is **NOT recommended** for production apps since they are bundled with the app. Instead, you want to generate a <RouterLink :to="`/${$site.themeConfig.typesenseLatestVersion}/api/api-keys.html#search-only-api-key`">search-only API key</RouterLink> and serve it to your app from a backend endpoint, along with your Typesense cluster endpoints. This way you can rotate your API keys and change your cluster endpoints at any point as needed.
233235

234236
4. Create the types file:
235237

0 commit comments

Comments
 (0)