Answer the question
In order to leave comments, you need to log in
Mobile First in react how to organize?
Good morning, I'm starting a project, maybe in the process of learning, I want to use the Mobile First approach, but I don't quite understand how to organize it in a React application.
A couple of times I saw a structure where the component is implemented for 3 devices ( mobile, table, desktop ):
- myComponent
- - desktop
- - - block.js
- - - block.css
- - tablet
- - - block.js
- - - block.css
- - mobile
- - - block.js
- - - block.css
Answer the question
In order to leave comments, you need to log in
Usually, the global state (redux, mobx, or just the state of the main component) is written something like:
// цифры условные
isDesktop: window.width > 1200,
isTablet: window.width <= 1200 && window.width > 768,
isMobile: window.width <= 768
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question