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

Don't useCallback unless necessary #24

Open
lifeiscontent opened this issue Jun 12, 2020 · 1 comment
Open

Don't useCallback unless necessary #24

lifeiscontent opened this issue Jun 12, 2020 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed ui User interface implementation
Milestone

Comments

@lifeiscontent
Copy link

const openMobileNav = useCallback(() => setIsMobileNavOpen(true));
const closeMobileNav = useCallback(() => setIsMobileNavOpen(false));

it's recommended by the react team to not useCallback unless you see perf issues. I'd recommend just creating the function without the useCallback hook.

@AkimaLunar AkimaLunar added good first issue Good for newcomers help wanted Extra attention is needed ui User interface implementation labels Jul 24, 2020
@AkimaLunar AkimaLunar added this to the Rebrand 2.0 milestone Jul 24, 2020
@tsdamas
Copy link

tsdamas commented Apr 12, 2022

Hello @AkimaLunar,

I believe I can get this one fixed. It is just to remove the useCallback function and the code would be like:

const openMobileNav = () => setIsMobileNavOpen(true);

As some others projects they are requesting to add the issue in a different file, I believe it is better to confirm if it is okay change the code in the file (website/src/components/constructs/Layout/partials/Nav/Nav.js) and add it in a different branch?

If this is okay, I will do a PR ASAP.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed ui User interface implementation
Projects
None yet
Development

No branches or pull requests

3 participants