파이어베이스로 호스팅을 하기 때문에 하나의 프로젝트에 하나의 소스만 올릴수 있다.
따라서 두가지 방법이 있다.
1안
웹용 소스, 모바일용 소스를 각각의 프로젝트에 올려서
domain.com 과 m.domain.com에 적용할지
2안
하나의 소스 내부에서 PC || Table || Mobile 을 판단해서 이에 따라
적용할 소스를 바꿔주는 것이다.
관련 정보를 찾아본 결과
"반응형 모듈" 을 사용해서 구현하는것이 대중적으로 보인다.
이는 화면의 크기에 따라 구분하는 것이다.
github.com/contra/react-responsive#react-responsive--
contra/react-responsive
CSS media queries in react - for responsive design, and more. - contra/react-responsive
github.com
혹은 Android 에서는 사용자 에이전트에 의해서 구분짓는 것을 권장하는데
화면의 크기가 아닌 기기의 종류를 판단이 필요로 보인다.
github.com/duskload/react-device-detect#react-device-detect
duskload/react-device-detect
Detect device, and render view according to detected device type. - duskload/react-device-detect
github.com
필요에 의해서는 위의 두가지를 합쳐서 사용할 수도 있을 것이다.
사용자의 기기 환경에 따른 기능을 제공해야 하기 때문에 "react-device-detect"를 우선적으로 사용하겠다.(2안)
참고.
www.npmtrends.com/react-responsive-vs-react-device-detect
react responsive vs react device detect | npm trends
Compare npm package download statistics over time: react responsive vs react device detect
www.npmtrends.com
'JavaScript > React' 카테고리의 다른 글
[React] React + Typescript + SCSS + Webpack + Babel (0) | 2022.08.04 |
---|---|
[React] Useful Third Party Library (0) | 2022.07.14 |
[React, 두둥] React Router 를 이용한 페이지 이동 (0) | 2021.03.19 |
[React,두둥] 카카오톡 로그인 (1) (0) | 2021.03.18 |
[React, Next.js] When to Use Static Generation VS Server-side Rendering (0) | 2020.10.25 |
댓글