News Score: Score the News, Sort the News, Rewrite the Headlines

JSX Over The Wire — overreacted

Suppose you have an API route that returns some data as JSON: app.get('/api/likes/:postId', async (req, res) => { const postId = req.params.postId; const [post, friendLikes] = await Promise.all([ getPost(postId), getFriendLikes(postId, { limit: 2 }), ]); const json = { totalLikeCount: post.totalLikeCount, isLikedByUser: post.isLikedByUser, friendLikes: friendLikes, }; res.json(json); }); You also have a React component that needs that data: function LikeButton({ totalLikeCount, isLikedByUser, fr...

Read more at overreacted.io

© News Score  score the news, sort the news, rewrite the headlines