enzymejs/enzyme

Why is `.wrap()` not included in the documentation?

Open

#2.249 geöffnet am 1. Okt. 2019

Auf GitHub ansehen
 (15 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (2.016 Forks)batch import
feature requesthelp wanted

Repository-Metriken

Stars
 (19.979 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Sorry for not following the template, but it is a simple request.

Why is .wrap() not included in the documentation?

As you can see here #919 at least more 6 people found this method useful. Just for completion it should be in the docs. Even if a note is included against the use of it and a suggestion of how to better write the component.

The author suggested to write the PR, I put myself available to do the same.

My use case

My use case is a HOC <Flow> that receives the content component <Step> as a prop. The component <Container>, which renders this HOC, renders the <Step> conditionally based on the current step of a specific flow. I'm using useMemo() to render this component inside the <Container> and that's why I need .wrap() to wrap the <Step> passed as a prop to <Flow>.

I could use a separate function to conditionally render and return <Step>, but this would obscure the code and have the same behavior: this function would be wrapped in a useMemo() and passed as a prop to <Flow>.

Contributor Guide