1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[275],{275:function(n,s,a){a.r(s);var e=a(85893),c=a(11151);function t(n){let s=Object.assign({p:"p",pre:"pre",code:"code",span:"span",img:"img"},(0,c.ah)(),n.components),{InternalLink:a}=s;return a||function(n,s){throw Error("Expected "+(s?"component":"object")+" `"+n+"` to be defined: you likely forgot to import, pass, or provide it.")}("InternalLink",!0),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.p,{children:"ååã¯ãFirestore Databese ã®åä¸ãã¼ã¿ãæå¾ããããã³ãã¨ã³ãã«è¡¨ç¤ºãã¾ããã"}),"\n",(0,e.jsx)(a,{slug:"firebase-firestore-database-get",image:"/images/243-image1.png",contents:"ãFirebaseãFirestore Databeseã®åä¸ãã¼ã¿ãåå¾ããããã³ãã¨ã³ãã«è¡¨ç¤ºãã"}),"\n",(0,e.jsx)(s.p,{children:"ä»åã¯ãFirestore Databese ã®ãã¼ã¿ãã¼ã¹ããªã¢ã«ã¿ã¤ã ã§åå¾ãã¾ãã"}),"\n",(0,e.jsx)(s.p,{children:"ã¾ãã¯ãã©ã®ã³ã³ãã¼ãã³ãã§ãå¤ãåãåããããã«ãããã®ã§ãããã¯ã使ãã¾ãã"}),"\n",(0,e.jsx)(s.p,{children:"hooks ãã©ã«ãã使ããuseFirebase.js ã使ãã¾ãããã"}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token function-variable function",children:"useFirebase"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"data"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n",(0,e.jsx)(s.span,{className:"token keyword module",children:"export"})," ",(0,e.jsx)(s.span,{className:"token keyword module",children:"default"})," useFirebase",(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsxs)(s.p,{children:[(0,e.jsx)(s.code,{children:"useState"}),"ã§ç¶æ
管çãã¾ãããã"]}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"documents",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," setDocuments",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"useState"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token keyword null nil",children:"null"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsx)(s.p,{children:"â»useState ã®ä¸èº«ã null ã«ãã¦ãã¾ãã¨ãã¨ã©ã¼ãçºçãã¾ãã\n以ä¸ã®ã³ã¼ãã«ä¿®æ£ãã¦ãã ããã"}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"documents",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," setDocuments",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"useState"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token keyword null nil",children:"null"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsx)(s.p,{children:"詳ããã¯ããã¡ãã§ã確èªãã ããã"}),"\n",(0,e.jsx)(a,{slug:"react-useeffect-null",image:"/images/246-image1.png",contents:"ãReactãã¨ã©ã¼ãUncaught TypeError: Cannot read properties of null (reading '0')ããè§£æ¶ãã"}),"\n",(0,e.jsxs)(s.p,{children:["firebase/firestore ãã",(0,e.jsx)(s.code,{children:"collection"}),"ã¨",(0,e.jsx)(s.code,{children:"onSnapshot"}),"ãã¤ã³ãã¼ããã¾ãã"]}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token keyword module",children:"import"})," ",(0,e.jsxs)(s.span,{className:"token imports",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," collection",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," onSnapshot ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"})]})," ",(0,e.jsx)(s.span,{className:"token keyword module",children:"from"})," ",(0,e.jsx)(s.span,{className:"token string",children:'"firebase/firestore"'}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsxs)(s.p,{children:[(0,e.jsx)(s.code,{children:"useEffect"}),"ãè¨å®ããããã¯ã«",(0,e.jsx)(s.code,{children:"data"}),"ãè¨å®ã¾ãã"]}),"\n",(0,e.jsxs)(s.p,{children:[(0,e.jsx)(s.code,{children:"firebaseApp"}),"ãã¤ã³ãã¼ããã",(0,e.jsx)(s.code,{children:"firestore"}),"ã使ç¨ãã¾ãã"]}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token function",children:"useEffect"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," firestore ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," firebaseApp",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"firestore"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"data",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsxs)(s.p,{children:[(0,e.jsx)(s.code,{children:"collection"}),"ã«",(0,e.jsx)(s.code,{children:"firestore"}),"ã¨",(0,e.jsx)(s.code,{children:"data"}),"ãæå®ãã¾ãã"]}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token function",children:"useEffect"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," firestore ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," firebaseApp",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"firestore"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," docRef ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"collection"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"firestore",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," data",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"data",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsx)(s.p,{children:"onSnapshot ã使ã£ã¦ããã¼ã¿ãåå¾ãã¾ãã"}),"\n",(0,e.jsx)(s.p,{children:"ã¾ããresults ã¨ãã空ã®é
åãæºåãã¾ãããã"}),"\n",(0,e.jsx)(s.p,{children:"ãã¼ã¿ã results ã«å
¥ããããã«ãã¾ãã"}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token function",children:"onSnapshot"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"docRef",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"snapshot"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"let"})," results ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n snapshot",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"docs"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"forEac
1h"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"doc"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n results",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"push"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," ",(0,e.jsx)(s.span,{className:"token spread operator",children:"..."}),"doc",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"data"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token literal-property property",children:"id"}),(0,e.jsx)(s.span,{className:"token operator",children:":"})," doc",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"id"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token function",children:"setDocuments"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"results",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsx)(s.p,{children:"onSnapshot ã颿°ã¨ãã¦ãªã¿ã¼ã³ãã¾ãã"}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token function",children:"useEffect"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," firestore ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," firebaseApp",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"firestore"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," docRef ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"collection"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"firestore",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," data",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," unsub ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"onSnapshot"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"docRef",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"snapshot"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"let"})," results ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n snapshot",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"docs"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"forEac
1h"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"doc"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n results",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"push"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," ",(0,e.jsx)(s.span,{className:"token spread operator",children:"..."}),"doc",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"data"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token literal-property property",children:"id"}),(0,e.jsx)(s.span,{className:"token operator",children:":"})," doc",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"id"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token function",children:"setDocuments"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"results",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token keyword control-flow",children:"return"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token function",children:"unsub"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"data",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsxs)(s.p,{children:["ç¶æ
管çãã¦ãã",(0,e.jsx)(s.code,{children:"documents"}),"ããªã¿ã¼ã³ãã¾ãã"]}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token keyword module",children:"import"})," ",(0,e.jsxs)(s.span,{className:"token imports",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," firebaseApp ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"})]})," ",(0,e.jsx)(s.span,{className:"token keyword module",children:"from"})," ",(0,e.jsx)(s.span,{className:"token string",children:'"../firebase/firebaseConfig"'}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token function-variable function",children:"useFirebase"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"data"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"documents",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," setDocuments",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"useState"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token keyword null nil",children:"null"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token console class-name",children:"console"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"log"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"documents",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token function",children:"useEffect"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," firestore ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," firebaseApp",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"firestore"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," docRef ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"collection"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"firestore",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," data",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," unsub ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"onSnapshot"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"docRef",(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"snapshot"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"let"})," results ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n snapshot",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"docs"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"forEac
1h"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"doc"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n results",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"push"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," ",(0,e.jsx)(s.span,{className:"token spread operator",children:"..."}),"doc",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"data"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token literal-property property",children:"id"}),(0,e.jsx)(s.span,{className:"token operator",children:":"})," doc",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"id"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token function",children:"setDocuments"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"results",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token keyword control-flow",children:"return"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token function",children:"unsub"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:","})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),"data",(0,e.jsx)(s.span,{className:"token punctuation",children:"]"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token keyword control-flow",children:"return"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," documents ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n",(0,e.jsx)(s.span,{className:"token keyword module",children:"export"})," ",(0,e.jsx)(s.span,{className:"token keyword module",children:"default"})," useFirebase",(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsx)(s.p,{children:"ãã¡ãã®ããã¯ã BooksGet.js ã«ã¤ã³ãã¼ããã使ç¨ãã¾ãã"}),"\n",(0,e.jsx)(s.p,{children:"弿°ã«ã¯ãcollection ã§ããâBooksâãæå®ãã¾ãã"}),"\n",(0,e.jsx)(s.pre,{className:"language-jsx",children:(0,e.jsxs)(s.code,{className:"language-jsx",children:[(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token function-variable function",children:(0,e.jsx)(s.span,{className:"token maybe-class-name",children:"BooksGet"})})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword",children:"const"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"{"})," ",(0,e.jsx)(s.span,{className:"token literal-property property",children:"documents"}),(0,e.jsx)(s.span,{className:"token operator",children:":"})," books ",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"="})," ",(0,e.jsx)(s.span,{className:"token function",children:"useFirebase"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token string",children:'"Books"'}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n ",(0,e.jsx)(s.span,{className:"token console class-name",children:"console"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"log"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"books",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n ",(0,e.jsx)(s.span,{className:"token keyword control-flow",children:"return"})," books",(0,e.jsx)(s.span,{className:"token punctuation",children:"["}),(0,e.jsx)(s.span,{className:"token number",children:"0"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"]"})," ",(0,e.jsx)(s.span,{className:"token operator",children:"?"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"\n books",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token method function property-access",children:"map"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),(0,e.jsx)(s.span,{className:"token parameter",children:"book"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token arrow operator",children:"=>"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"\n ",(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"<"}),"div"]})," ",(0,e.jsx)(s.span,{className:"token attr-name",children:"key"}),(0,e.jsxs)(s.span,{className:"token script language-javascript",children:[(0,e.jsx)(s.span,{className:"token script-punctuation punctuation",children:"="}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"book",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"id"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"}"})]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token plain-text",children:"\n "}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"<"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"book",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"title"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"</"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token plain-text",children:"\n "}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"<"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"book",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"author"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"</"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token plain-text",children:"\n "}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"<"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token punctuation",children:"{"}),"book",(0,e.jsx)(s.span,{className:"token punctuation",children:"."}),(0,e.jsx)(s.span,{className:"token property-access",children:"category"}),(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"</"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token plain-text",children:"\n "}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"</"}),"div"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:")"})," ",(0,e.jsx)(s.span,{className:"token operator",children:":"})," ",(0,e.jsx)(s.span,{className:"token punctuation",children:"("}),"\n ",(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"<"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),(0,e.jsx)(s.span,{className:"token plain-text",children:"ãã¼ã¿ãããã¾ãã"}),(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsxs)(s.span,{className:"token tag",children:[(0,e.jsx)(s.span,{className:"token punctuation",children:"</"}),"p"]}),(0,e.jsx)(s.span,{className:"token punctuation",children:">"})]}),"\n ",(0,e.jsx)(s.span,{className:"token punctuation",children:")"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n",(0,e.jsx)(s.span,{className:"token punctuation",children:"}"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n\n",(0,e.jsx)(s.span,{className:"token keyword module",children:"export"})," ",(0,e.jsx)(s.span,{className:"token keyword module",children:"default"})," ",(0,e.jsx)(s.span,{className:"token maybe-class-name",children:"BooksGet"}),(0,e.jsx)(s.span,{className:"token punctuation",children:";"}),"\n"]})}),"\n",(0,e.jsx)(s.p,{children:"ãã©ã¦ã¶ã§ç¢ºèªããã¨ã"}),"\n",(0,e.jsx)(s.p,{children:(0,e.jsx)(s.img,{src:"/images/244-image2.png",alt:"image2"})}),"\n",(0,e.jsx)(s.p,{children:"Firebase Database ã®ãã¼ã¿ã表示ããã¾ããã"}),"\n",(0,e.jsx)(s.p,{children:"試ãã«ãFirebase Database ã§ãã¼ã¿ãå
¥åããã¨ã"}),"\n",(0,e.jsx)(s.p,{children:(0,e.jsx)(s.img,{src:"/images/244-image3.png",alt:"image3"})}),"\n",(0,e.jsx)(s.p,{children:(0,e.jsx)(s.img,{src:"/images/244-image4.png",alt:"image4"})}),"\n",(0,e.jsx)(s.p,{children:"å³åº§ã«ãã©ã¦ã¶ãæ´æ°ããã¾ããã"}),"\n",(0,e.jsx)(s.p,{children:"次åã¯ããã©ã¦ã¶ã§éä¿¡ãããã¼ã¿ããFirestore Databese ã«ä¿åãã¾ãã"}),"\n",(0,e.jsx)(a,{slug:"firebase-firestore-database-post",image:"/images/245-image1.png",contents:"ãFirebaseããã©ã¦ã¶ã§éä¿¡ãããã¼ã¿ããFirestore Databeseã«ä¿åãã"})]})}s.default=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,c.ah)(),n.components);return s?(0,e.jsx)(s,Object.assign({},n,{children:(0,e.jsx)(t,n)})):t(n)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.