Notice
Recent Posts
Recent Comments
Link
250x250
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- owlcarousel
- 단어단위로떨어지기
- XEIcon
- 글자들여쓰기
- 이미지반응형
- npm start
- fontawesome
- 정적객체
- slickslider
- git lab clone
- vscode git clone
- npm install 문제
- maxwidth
- MediaQuery
- react npm install
- Git clone
- legacy-peer
- node 오류
- package.json
- window 정책변경
- 아이콘사용법
- 동적객체
- npm install
- 플러그인
- 웹아이콘
- 그누보드반응형
- googleicon
- node설치
- minwidth
- 의존성문제
Archives
- Today
- Total
어쩌다 알게 된 ƪ(•̃͡•̃͡ ƪ
[FE] type.maybe, maybeNull 본문
728x90
[FE] MST란?
🔖 MST = MobX State Tree👉 React 앱에서 “전역 상태(공용 데이터)”를 관리하기 위한 도구 앱 전체에서 쓰는 데이터를규칙(타입) 있게안전하게예측 가능하게 관리 🔖 사용 이유useState는 컴포넌트에
dazzle-bini.tistory.com
const Company = types
.model({
logoBase64: types.maybe(types.string), ✔️maybe가 무엇인가
})
.actions(self => ({
setLogoBase64(value) {
self.logoBase64 = value;
}
}));
❓✔️maybe가 무엇인가
👩💻 logoBase64: types.maybe(types.string),
=> 처음에는 없을 수도(undefined/null), 나중에 문자열이 될 수도 있는 값
👩💻 logoBase64: types.maybeNull(types.string),
=> string 이거나, null 일 수 있으며, 나중에 문자열이 될 수도 있는 값
=> undefined는 안 됨
👩💻 logoBase64: types.optional(types.string, '')
=> 항상 문자열인데, 기본값은 빈 문자열
😮 단점
- '(빈 문자열)도 truthy/falsey 판단 헷갈림
- 실제로는 “값이 없다” 와 “값은 있는데 비어있다” 를 구분 못함
728x90
'개발 > 🟦 React' 카테고리의 다른 글
| [FE] MST란? React_MobX State Tree (0) | 2026.01.07 |
|---|---|
| React useEffect로 body class넣기 / 리팩토링 (0) | 2026.01.06 |
| ReactSortable 드래그, 솔팅 기능_리액트 라이브러리 (0) | 2025.12.31 |
| 다국어 처리 useTranslation() 훅 사용 (0) | 2025.12.03 |
| useRef로 resize width 계산 후 class 넣기 (0) | 2025.12.01 |
Comments