Read the chapter that covers how a request works, laravel starts all over every request anyway.
Jul 21, 2023
5
Level 2
Does importing usePage() repeatedly affect performance?
I've finalized setting up dark mode settings in my VILT project using useDark and useToggle from useVue Library in my layout template.
The problem is that I'm using many external components that applies dark mode using a boolean prop, so using tailwind's dark: property does not work, and passing isDark property from the main layout to the children component isn't feasible since I have many components.
So I ended up importing useDark component on every page that contains these external components so that I can pass isDark parameter to apply dark mode.
My question is:
- Is there a more practical and cleaner solution to this?
- Per my understanding, importing 1 library repeatedly within the same project does not affect performance or project size after building, except that chatGPT told me it can have an effect. Is it true that this can have an impact on the project, especially that
useVueis not a lightweight library?
Please or to participate in this conversation.