You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add detection of useImperativeHandle()-defined methods on components, including test cases and README documentation.
Additional background: I have a component I've just refactored from a class-based implementation to the new hooks-style implementation, and am publishing the documentation via Styleguidist. Somewhat to my surprise, the once-public methods on the class, which are now exposed via useImperativeHandle(), are no longer showing up in the generated documentation. Digging in, this appears to be the correct place to get those methods exposed.
Note that this does not address the desire to document custom hooks, nor does it find useCallback() handlers as those aren't exposed in an imperative way and thus shouldn't be considered a part of a component's public API.
Add detection of `useImperativeHandle()`-defined methods on components, including test cases and README documentation.
Signed-off-by: Jared Reisinger <jaredreisinger@hotmail.com>
@danez, has react-docgen gone into maintenance mode? I know that for the most part, there's not a lot to do since Javascript hasn't changed that much. That said, React added hooks in 16.8.0 (February 6, 2019), 19 months ago, so adding support for this isn't exactly "cutting edge" at this point.
I've tried to make sure the proposed change is well documented and tested... is there anything else I can do to make it easier or less-risky to merge?
The reason will be displayed to describe this comment to others. Learn more.
I don't know.... I'll take a look at #464 and try to understand what it's doing. At first blush, it seems like yes, this might exactly solve that problem, I'll just need to understand what changes I'll need to make to use the new functionality (or whether things have changed in such a way that I don't have to do anything, and just get the new behavior for free 🤞 ).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add detection of
useImperativeHandle()-defined methods on components, including test cases and README documentation.Note that this does not address the desire to document custom hooks, nor does it find
useCallback()handlers as those aren't exposed in an imperative way and thus shouldn't be considered a part of a component's public API.