ご閲覧いただきまして、ありがとうございます。
こちらのページで質問させていただいた内容なのですが誤って「解決済み」にしてしまった、また問題となっている点が誤っていたことが判明したため、再度ご質問させていただきます。
下記のようなソースコードで、Itemの一覧を表示させたいと考えているのですが、コンソールではItemが表示されますが、ビューでは表示されません。
JavasScript
1class App extends Component { 2 constructor(props) { 3 super(props); 4 this.state = { 5 items: [] 6 }; 7 } 8 9 async componentDidMount() { 10 const items = []; 11 12 firebase 13 .firestore() 14 .collection("items") 15 .get() 16 .then(function(querySnapshot) { 17 querySnapshot.forEach(function(doc) { 18 items.push(doc.data()); 19 }); 20 }); 21 22 this.setState({ items: items }); 23 } 24 25 render() { 26 const items = this.state.items; 27 console.log("items", items); 28 return ( 29 <div> 30 <div> 31 <ul> 32 {items.map(item => ( 33 <li> 34 <span>{item.name}()</span> 35 </li> 36 ))} 37 </ul> 38 </div> 39 ); 40 } 41} 42 43export default App; 44
指定の仕方が誤っているのでしょうか?
どうぞよろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/15 10:29
退会済みユーザー
2019/08/15 11:19
退会済みユーザー
2019/08/15 11:20
2019/08/15 19:25
退会済みユーザー
2019/08/16 01:29
2019/08/18 08:10