Respect "rules of hooks" in `<SmartCustomizingPreferredReactionsModal>`

This commit is contained in:
Evan Hahn 2021-09-10 17:50:56 -05:00 committed by GitHub
parent 4ef56667e2
commit d94f1151b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -25,11 +25,6 @@ export function SmartCustomizingPreferredReactionsModal(): JSX.Element {
StateType,
ReturnType<typeof getCustomizeModalState>
>(state => getCustomizeModalState(state));
if (!customizeModalState) {
throw new Error(
'<SmartCustomizingPreferredReactionsModal> requires a modal'
);
}
const recentEmojis = useRecentEmojis();
@ -37,6 +32,12 @@ export function SmartCustomizingPreferredReactionsModal(): JSX.Element {
getEmojiSkinTone(state)
);
if (!customizeModalState) {
throw new Error(
'<SmartCustomizingPreferredReactionsModal> requires a modal'
);
}
return (
<CustomizingPreferredReactionsModal
i18n={i18n}