Skip to content

Extract out search logic into a separate export #36

@silasb

Description

@silasb

I'd be extremely helpful to extract out the search logic into a separate export that can be used outside JSX code.

Problem

I have a text toggle component that shows/hides text. I also have a search box that can search for text. If I haven't toggled the text component and I search I still want to know the number of hits that a search would highlight. I can't easily do this now without duplicating logic between this component and my search component.

Solution

If we extract out the search logic into a separate export, I could generate my RE, do the search, get the number of hits, then when I toggle the text view, render Highlight with the same RE and I should have the same number of hits as I do highlights.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions