Design comparison
Solution retrospective
guys if you can share with me any kind of experience with hosting 'vite' projects, which hosting service is good? which config is good?
Community feedback
- @asbhogalPosted over 1 year ago
Hi there,
This is a very good solution design-wise - the mockups match nicely. There are some important things to note however:
-
You should use React's native state management to handle the logic of the application. I haven't seen all the code, but just looking at the ThemeSwitcher, you're directly modifying the DOM with
document.documentElement.dataset.theme
. This is basically vanilla JS, which isn't exactly wrong, but it isn't leveraging the purpose of React. -
Essentially you should be using hooks like
useState
to set a state variable and update it's value via the setter function, anduseEffect
to handle the color preference detection, as well as an event listener to detect changes in the color scheme preference and update the UI based on the user's preferences and actions (which updates the state accordingly). This will lead to a more robust, stable component. If you haven't used native state management in React before, it would be good to review/look into this. -
With regards to your question - Netlify or Vercel are ideal for front-end, client side applications, (vanilla, React, Angular etc.) I use Vercel, which automatically detects the Vite framework and builds your project each time you push your changes to the
main
branch (without needing to run a build script beforehand.) They handle caching, performance and overall stability very well and Vercel has CI/CD to manage deployments for bothmain
and other branches, watching for errors during build time. You can set an account up with GitHub and deploy your projects from selecting your repos.
Hope this helps!
1@FETYagencyPosted over 1 year ago@asbhogal dude your experience worth more than what i am reading, i will start looking at vercel now! And when it comes to react code, actually it is first day learning and it took from me 2 days to build this project to learn how to describe the UI and adding interactivity, and today i will learn how to manage states after that i will learn about hooks so right there i will enhance the current code, and i will take your first note about leavraging react into my brain so i can see in the comming days how i should implement it. If you have more to teach me, you need to know that i am greedy and i will so happy to have it from you Thanks for your time brother
1@asbhogalPosted over 1 year ago@FETYagency no problem at all, glad to help! Look forward to seeing more projects and hope the React work goes well!
0 -
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord