unstale

npm / react-highlight-words

react-highlight-words

What changed in react-highlight-words 0.21 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.

11 breaking4 new APIs and options1 performance2 behavior and defaults1 tooling8 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.1 on npm

react-highlight-words 120 changes

Breaking changes 8

  • String search words are matched literally by default because autoEscape now defaults to true.

    1.0.0release notes

  • The exported Chunk type now requires searchIndex, the index of the matching search word.

    1.0.0release notes

  • highlight-words-core 2.0 is published as ES2020, so environments and bundlers that cannot parse that syntax need to transpile it.

    1.0.0release notes

  • Only the package root can be imported; deep imports are no longer available.

    1.0.0release notes

  • Custom findChunks functions must return searchIndex in each chunk and now receive every option with its default applied.

    1.0.0release notes

  • React 16.3 or newer is required; React 0.14, 15, and 16.0–16.2 are no longer supported.

    1.0.0release notes

  • A ref is forwarded to the outer wrapper span; this requires React 16.3 or newer.

    1.0.0release notes

  • When sanitize changes text, it is applied to each character separately, so context-dependent sanitizers produce different results.

    1.0.0release notes

New APIs and options 2

  • FoundChunk is exported as an alias of Chunk, matching its name in highlight-words-core.

    1.0.0release notes

  • Custom highlightTag components receive searchIndex, identifying the matching search word.

    1.0.0release notes

Behavior and default changes 2

  • When autoEscape is false, invalid regular-expression strings are matched literally instead of throwing an error.

    1.0.0release notes

  • Search words can include RegExp objects, which are used as-is with their own flags.

    1.0.0release notes

Fixes and other changes 8

  • Inactive matches no longer have a trailing space in their class name, and elements without a class name no longer render an empty class attribute.

    1.0.0release notes

  • CommonJS consumers now get correct component and namespace types, including with node16 module resolution.

    1.0.0release notes

  • For object values, unmatched text uses the class of the search word that matched instead of an undefined class name.

    1.0.0release notes

  • Object values no longer give matches such as constructor or toString a class name from inherited properties.

    1.0.0release notes

  • Matches line up with the original text when sanitize changes its length.

    1.0.0release notes

  • searchWords can be a readonly array, allowing values such as arrays declared with as const.

    1.0.0release notes

  • Surrogate pairs such as emoji are no longer split between highlighted and unhighlighted text.

    1.0.0release notes

  • A missing or non-string textToHighlight from untyped callers no longer throws an error.

    1.0.0release notes

react-highlight-words 0.217 changes

Breaking changes 3

  • Removes the UMD build.

    0.21.1release notes

  • Stops bundling highlight-words-core and installs it as a regular dependency at ^1.2.0.

    0.21.1release notes

  • The package targets ES2018+ syntax instead of ES5; environments unable to parse it need to transpile the package.

    0.21.1release notes

New APIs and options 2

  • Adds TypeScript definitions, including HighlighterProps, HighlightTagProps, UnhighlightTagProps, Chunk and FindChunksOptions.

    0.21.1release notes

  • Adds an ES module build and exposes it through the package's module field.

    0.21.1release notes

Performance 1

  • When caseSensitive is false, lowercases object keys once per render instead of once per match.

    0.21.1release notes

Tooling 1

  • Moves the CommonJS entry point from dist/main.js; require("react-highlight-words") still returns the component directly.

    0.21.1release notes