i have posted some data in firebase using my form and now i want to pull that data from realtime database of firebase
https://github.com/Pranishshrestha-react/gssa.git
addPostWithFirebase= async(post) => { try{ const addPost = await axios.post (
${BASE_URL}/posts.json
, post)} catch(error) { console.log ('addpost', error) } }
i did this just to get the posted items and change it into array
showPostWithFirebase = async() => { const allPosts = await axios.get(
${BASE_URL}/posts.json
); const userIds = Object.keys(allPosts.data); const posts = userIds.map(userId => { return{ ...allPosts.data[userId], id: userId }}) }
now i want this array to be displayed in my home screen using context. please help
https://stackoverflow.com/questions/66937918/pull-array-from-firebase-and-post-using-axios April 04, 2021 at 12:02PM
没有评论:
发表评论