react-generate-context
react-generate-context copied to clipboard
Add `displayName` option for Provider
Because the Provider is created inside the closure of generateContext, it's generically named Provider. So even though you give it a variable name when you destructure it, it still shows up as Provider in your React dev tools. Adding an option for displayName would make this a bit better.
I believe this can be achieved by:
- [ ] adding
providerDisplayNameas an option - [ ] Default it to
undefinedornull, just a falsy value that makes sense - [ ]
if (providerDisplayName) Provider.displayName = providerDisplayName - [ ] Updating docs
It should be noted, that one can add a display name very simply on their own if they need it, this would just be a convenience to the user. They are, of course, welcome to do:
const [MyProvider, useMyContext] = generateContext(useManageValue)
MyProvider.displayName = 'MyProvider'