This is a solution to the Advice generator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the app depending on their device's screen size
- See hover states for all interactive elements on the page
- Generate a new piece of advice by clicking the dice icon
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- Mobile-first workflow
- React - JS library
- Styled Components - For styles
- Preventing useEffect from infinte loop by using []
useEffect(() => {
//funcion here
}, []);
- How to get the width of a DOM element
const footerRect = document.getElementById('id').getBoundingClientRect();
console.log(footerRect.width);
- No cahce storing when fetching from an API (extra useful when working with firefox)
fetch('api_url', {
cache: 'no-store',
});
Dive more into react hooks and working with APIs and localStorage usage among other things
- getBoundingClientRect - When in doubt MDN is your friend
- Frontend Mentor - @serfoll
- Twitter - @sergio_fol