Introduction
When trying to use @elastic/react-search-ui in a project using React 19 and Next.js 15, you may encounter the following dependency error.
This article explains the cause of this problem and how to resolve it in detail.
Cause of the Problem
The peer dependency of @elastic/react-search-ui@1.23.1 was react@">= 16.8.0 < 19", which did not support React 19.
Solution
1. Package Upgrade
In May 2025, PR #1162 was merged and React 19 support was added. Use version 1.24.2 or later.
2. Handling Type Definition Changes
In 1.24.2, the type definitions for the WithSearch component have changed. The filters in SearchContextState is now Filter[] | undefined.
Before (1.23.x)
After (1.24.x)
3. setFilter Type Change
The type of setFilter has also changed.
The call site also needs modification:
Example Files That Need Changes
In this project, the following files were modified:
src/components/page/search/Range.tsxsrc/components/search/Facet.tsxsrc/components/search/Facets.tsxsrc/components/search/Filters.tsx
Note: Migration to Next.js 16
We also attempted migration to Next.js 16, but there were many breaking changes that required additional handling:
- Dependency on React 19.2
- Renaming from middleware to proxy
- Turbopack becomes the default
- Forced async APIs
For stability, we recommend running on Next.js 15.5.9.
Version Compatibility Table
| Package | React 18 | React 19 |
|---|---|---|
| @elastic/react-search-ui 1.23.x | ✅ | ❌ |
| @elastic/react-search-ui 1.24.2+ | ✅ | ✅ |
| Next.js 15.5.x | ✅ | ✅ |
| Next.js 16.x | - | ✅ (requires additional handling) |
Summary
- Upgrade
@elastic/react-search-uito 1.24.2 or above - Handle the
WithSearchtype definition changes (undefined handling) - Next.js 15.5.9 is recommended (16 has many breaking changes)
Reference Links
Created: 2026-01-19