![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-instantsearch-nextjs
Advanced tools
This package provides server-side rendering for React InstantSearch that is compatible with Next.js 13 App Router.
[!WARNING] This package is experimental.
yarn add react-instantsearch-nextjs
# or with npm
npm install react-instantsearch-nextjs
[!NOTE] You can check this documentation on Algolia's Documentation website.
Your search component must be in its own file, and it shouldn't be named page.js
or page.tsx
.
To render the component in the browser and allow users to interact with it, include the "use client" directive at the top of your code.
+'use client';
import algoliasearch from 'algoliasearch/lite';
import {
InstantSearch,
SearchBox,
} from 'react-instantsearch';
const searchClient = algoliasearch('YourApplicationID', 'YourSearchOnlyAPIKey');
export function Search() {
return (
<InstantSearch indexName="YourIndexName" searchClient={searchClient}>
<SearchBox />
{/* other widgets */}
</InstantSearch>
);
}
Import the <InstantSearchNext>
component from the react-instantsearch-nextjs
package, and replace the <InstantSearch>
component with it, without changing the props.
'use client';
import algoliasearch from 'algoliasearch/lite';
import {
- InstantSearch,
SearchBox,
} from 'react-instantsearch';
+import { InstantSearchNext } from 'react-instantsearch-nextjs';
const searchClient = algoliasearch('YourApplicationID', 'YourSearchOnlyAPIKey');
export function Search() {
return (
- <InstantSearch indexName="YourIndexName" searchClient={searchClient}>
+ <InstantSearchNext indexName="YourIndexName" searchClient={searchClient}>
<SearchBox />
{/* other widgets */}
- </InstantSearch>
+ </InstantSearchNext>
);
}
To serve your search page at /search
, create an app/search
directory. Inside it, create a page.js
file (or page.tsx
if you're using TypeScript).
Make sure to configure your route segment to be dynamic so that Next.js generates a new page for each request.
// app/search/page.js or app/search/page.tsx
import { Search } from './Search'; // change this with the path to your <Search> component
export const dynamic = 'force-dynamic';
export default function Page() {
return <Search />;
}
You can now visit /search
to see your server-side rendered search page.
<InstantSearchNext>
The <InstantSearchNext>
component is a drop-in replacement for the <InstantSearch>
component. It accepts the same props, and it renders the same UI.
You can check the InstantSearch API reference for more information.
routing
propAs with the <InstantSearch>
component, you can pass a routing
prop to the <InstantSearchNext>
component to customize the routing behavior. The difference here is that routing.router
takes the same options as the historyRouter
.
If you're experiencing issues, please refer to the Need help? section of the docs, or open a new issue.
We welcome all contributors, from casual to regular 💙
To start contributing to code, you need to:
yarn
Please read our contribution process to learn more.
React InstantSearch is MIT licensed.
FAQs
React InstantSearch SSR utilities for Next.js
The npm package react-instantsearch-nextjs receives a total of 12,668 weekly downloads. As such, react-instantsearch-nextjs popularity was classified as popular.
We found that react-instantsearch-nextjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.