Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract out search logic into a separate export #36

Open
silasb opened this issue Mar 3, 2017 · 0 comments
Open

Extract out search logic into a separate export #36

silasb opened this issue Mar 3, 2017 · 0 comments

Comments

@silasb
Copy link

silasb commented Mar 3, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants