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

Optimize some components for performance #1740

Closed
wants to merge 3 commits into from
Closed

Conversation

Jonas-C
Copy link
Contributor

@Jonas-C Jonas-C commented Jul 18, 2023

Prøver å redusere rendering-tid på fag-, emne- og ressurssider.

Comment on lines +21 to +29
const tooltip = useMemo(() => {
return isFavorite ? t('myNdla.resource.addedToMyNdla') : t('myNdla.resource.addToMyNdla');
}, [t, isFavorite]);

const ariaLabel = useMemo(() => {
return isFavorite ? t('myNdla.alreadyFavourited') : t('myNdla.addToFavourites');
}, [t, isFavorite]);

const Icon = useMemo(() => (isFavorite ? Heart : HeartOutline), [isFavorite]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blir ikke bruken av useMemo litt overflødig på såpass enkel logikk?

Copy link
Contributor Author

@Jonas-C Jonas-C Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En skulle trodd! Kunne nok sluppet greit unna med tooltip og ariaLabel men Icon er nesten nødvendig

@Jonas-C Jonas-C closed this May 30, 2024
@Jonas-C Jonas-C deleted the performance-tuning branch May 30, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants