投稿時間:2023-07-29 20:10:35 RSSフィード2023-07-29 20:00 分まとめ(16件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita 【google colaboratory】入門:グラフの描画と可視化の基礎 https://qiita.com/gk12/items/50e8bc4905e20c77cc56 colab 2023-07-29 19:42:30
python Pythonタグが付けられた新着投稿 - Qiita Python:データ分析基礎(pandas,matplotlib) https://qiita.com/myitoutput/items/6c5bcfec148c287132a1 解決方法 2023-07-29 19:40:55
python Pythonタグが付けられた新着投稿 - Qiita 遺伝的アルゴリズムに並列化プログラミングの実施と考察 https://qiita.com/avantia/items/2943147e64486e4fd2a5 codingu 2023-07-29 19:30:58
js JavaScriptタグが付けられた新着投稿 - Qiita 【JavaScript】async/awaitとaxios、非同期通信について https://qiita.com/MK32A/items/6a062be5189098cd67d5 asyncawait 2023-07-29 19:17:05
Ruby Rubyタグが付けられた新着投稿 - Qiita Rubyの将来性 https://qiita.com/Cookie_Iwate/items/f7dba28a83ced2ae13e5 目次 2023-07-29 19:27:45
Docker dockerタグが付けられた新着投稿 - Qiita [Google Cloud] Container-Optimized OSでDocker Compose v2を使えるようにする https://qiita.com/mmclsntr/items/627ced5abf4cbb484581 cloudcontaineroptimizedos 2023-07-29 19:17:12
海外TECH Ars Technica Communal stargazing using your phone: The Unistellar eQuinox 2, reviewed https://arstechnica.com/?p=1957544 light 2023-07-29 10:30:19
海外TECH MakeUseOf What Is the ChatGPT Code Interpreter? Why Is It So Important? https://www.makeuseof.com/what-is-chatgpt-code-interpreter/ chatgpt 2023-07-29 10:46:25
海外TECH MakeUseOf How to Protect Your Devices During Extreme Heat https://www.makeuseof.com/how-to-protect-devices-during-extreme-heat/ devices 2023-07-29 10:31:26
海外TECH MakeUseOf What to Do if You Can't Find Events in Your iPhone Calendar https://www.makeuseof.com/how-to-fix-cant-find-events-in-iphone-calendar/ calendar 2023-07-29 10:15:26
海外TECH MakeUseOf How to Create Email Newsletters With HTML: Best Design Practices https://www.makeuseof.com/create-email-newsletters-with-html/ design 2023-07-29 10:00:24
海外TECH DEV Community Enhancing User Experience with Daxus https://dev.to/jason89521/enhancing-user-experience-with-daxus-1f2f Enhancing User Experience with DaxusDaxus is an exceptional server state management library tailored for React applications With Daxus developers have complete control over their data allowing them to craft websites with superior user experiences Building a Better User Experience with DaxusLet s consider the scenario of developing a forum website Our website comprises various lists of posts such as popular latest recommended and more Users can interact with the posts for example by liking them and the post will display the total number of likes Initially we might opt for React Query to manage the server data Here s an example of how we could use React Query import useQuery useInfiniteQuery from tanstack react query export function usePost id number return useQuery queryKey post detail id queryFn gt axios get api post id export function usePostList forumId filter forumId string filter popular latest recommended return useInfiniteQuery queryKey post list forumId filter queryFn pageParam gt axios get api post page pageParam amp forumId forumId amp filter filter getNextPageParam lastPage pages gt lastPage nextCursor React Query provides the useQuery and useInfiniteQuery hooks to simplify data handling With just the queryKey and queryFn React Query efficiently manages the data for us Now let s address the logic of users liking a post import useMutation useQueryClient from tanstack react query export function useLikePost id number const client useQueryClient return useMutation mutationFn gt return likePostApi id onSuccess gt client invalidateQueries queryKey post When a user likes a post we invalidate all post data triggering a refetch of the post the user is currently viewing Moreover when the user returns to the post list it is also refetched displaying the updated like count However there is a noticeable delay between the user liking a post and the post displaying the updated like count To address this in the post view we can implement optimistic updates export function useLikePost id number const client useQueryClient return useMutation mutationFn gt return likePostApi id onMutate async gt await client cancelQueries queryKey post detail id client setQueryData post detail id old gt old likeCount old likeCount onError gt client setQueryData post detail id old gt old likeCount old likeCount onSettled gt client invalidateQueries queryKey post Now users can immediately see the result after liking a post However when they return to the post list they still see the old post data They have to wait for some delay to see the latest result Considering the multiple lists on our website finding the post in every list and then performing an optimistic update isn t efficient Daxus to the Rescue Enter Daxus With Daxus we can create a custom data structure for our post data ensuring that each post entity references the same data This feature allows us to eliminate the delay issue without any hassle Let s see how we can use Daxus to manage the post data import createDatabase createPaginationAdapter useAccessor from daxus export const database createDatabase export const postAdapter createPaginationAdapter lt Post gt export const postModel database createModel name post initialState postAdapter initialState export const getPost postModel defineAccessor name getPost async fetchData id number return axios get api post id syncState draft data postAdapter upsertOne draft data export const listPost postModel defineInfiniteAccessor name listPost async fetchData forumId filter forumId string filter popular latest recommended previousData const page previousData nextCursor return axios get api post page page amp forumId forumId amp filter filter syncState draft data arg forumId filter const key forumId amp filter postAdapter appendPagination draft key data export function usePost id number return useAccessor getPost id state gt postAdapter tryReadOne state id export function usePostList forumId filter forumId string filter popular latest recommended return useAccessor listPost forumId filter state gt const key forumId amp filter return postAdapter tryReadPagination state key items export async function likePost id number postModel mutate draft gt postAdapter readOne draft id likeCount try await likePostApi id catch postModel mutate draft gt postAdapter readOne draft id likeCount finally postModel invalidate In Daxus we provide the necessary instructions on how to update our state after fetching the data from the server The createPaginationAdapter function returns an object with operations for accessing pagination data If we need a more customizable data structure we can build our adapter as well Since each entity in the pagination data structure references the same data when a user likes a post and returns to any list they will immediately see whether they have liked that post No delays no fuss just a seamless user experience For more detailed information and code examples please visit the Daxus GitHub repository Daxus is continually evolving and your valuable feedback is crucial to making it even better Give Daxus a try and share your thoughts with us Let s create remarkable React applications together 2023-07-29 10:28:48
ニュース BBC News - Home Niger coup: EU suspends security cooperation and budgetary aid https://www.bbc.co.uk/news/world-africa-66337767?at_medium=RSS&at_campaign=KARANGA bazoum 2023-07-29 10:19:52
ニュース BBC News - Home Sweden 5-0 Italy: Arsenal's Amanda Ilestedt scores two goals in easy win https://www.bbc.co.uk/sport/football/66347280?at_medium=RSS&at_campaign=KARANGA Sweden Italy Arsenal x s Amanda Ilestedt scores two goals in easy winSweden turn on the style to demolish Group G rivals Italy and secure a place in the last of the Women s World Cup with one game to spare 2023-07-29 10:50:23
ニュース BBC News - Home Allan Saint-Maximin confirms Newcastle departure before expected Saud Arabia move https://www.bbc.co.uk/sport/football/66347973?at_medium=RSS&at_campaign=KARANGA Allan Saint Maximin confirms Newcastle departure before expected Saud Arabia moveFrench winger Allan Saint Maximin confirms he is leaving Newcastle United saying his greatest trophy was playing for the club 2023-07-29 10:08:01
ニュース BBC News - Home The Ashes: England back in the lead after three fours in first over https://www.bbc.co.uk/sport/av/cricket/66348760?at_medium=RSS&at_campaign=KARANGA ashes 2023-07-29 10:19:02

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)