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

[TypeScript] Fix useRecordContext doesn't work without props #6046

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

fzaninotto
Copy link
Member

Problem

TypeScript doesn't compile code where useRecordContext is called with no argument.

const record = useRecordContext();
               ------------------
                 expected 1 argument but got 0

But useRecordContext was designed to work even without props!

Solution

Make params optional

@fzaninotto fzaninotto added the RFR Ready For Review label Mar 16, 2021
@djhi djhi added this to the 3.13.5 milestone Mar 16, 2021
@djhi djhi merged commit b63e663 into master Mar 16, 2021
@djhi djhi deleted the useRecordContext-required-Props branch March 16, 2021 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants