IT |
ITmedia 総合記事一覧 |
[ITmedia Mobile] Samsung、「Galaxy S23」シリーズ向けゼロクリック攻撃防御機能「Message Guard」発表 他のGalaxyにも展開予定 |
https://www.itmedia.co.jp/mobile/articles/2302/19/news036.html
|
galaxy |
2023-02-19 07:44:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] ホワイト企業だと思う職場の特徴 3位「残業代の支払い」、2位「残業なし」、1位は? |
https://www.itmedia.co.jp/business/articles/2302/17/news162.html
|
itmedia |
2023-02-19 07:30:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
データの平均・共分散の逐次計算 |
https://qiita.com/kotai2003/items/45213387ab91be39a95a
|
計算 |
2023-02-19 07:32:32 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
CustomTkinter で作るおしゃれな Python GUI & フレームを活用したGUI作成チュートリアル |
https://qiita.com/key353/items/e59927dcf20916f9d4ac
|
customtkinter |
2023-02-19 07:08:49 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Docker の実験(その10:コンテナのレイヤ) |
https://qiita.com/intrajp/items/84c64c10f6f3e610920d
|
docker |
2023-02-19 07:46:28 |
海外TECH |
MakeUseOf |
7 Sites to Purchase Returned Merchandise Online |
https://www.makeuseof.com/sites-purchase-returned-merchandise/
|
online |
2023-02-18 22:30:16 |
海外TECH |
DEV Community |
Creating an App with React, Apollo, and GraphQL: A Step-by-Step Guide to Fetching Data and Error Handling |
https://dev.to/icyybee/creating-an-app-with-react-apollo-and-graphql-a-step-by-step-guide-to-fetching-data-and-error-handling-5bgh
|
Creating an App with React Apollo and GraphQL A Step by Step Guide to Fetching Data and Error HandlingAre you looking to build a modern web application with scalable data driven user interfaces Then this article is for you In this step by step guide I ll walk you through the steps required to fetch data from a GraphQL endpoint using Apollo Client in a React application and how to handle errors that may occur during the process IntroductionIn case you are not familiar with the terms GraphQL is a powerful query language for APIs Application Programming Interface that was developed by Facebook It provides a more efficient powerful and flexible alternative to REST APIs Representational State Transfer Application Programming Interface for building modern web applications With GraphQL instead of requesting pre defined data structures from a server clients can specify exactly what data they need and receive a JSON JavaScript Object Notation object that matches their request This means that you can retrieve only the data you need reducing the amount of network traffic and improving performance See DocumentationApollo Client is a JavaScript library that provides a way to interact with a GraphQL API from a client side application It allows you to fetch data from a GraphQL server cache it locally and manage its state in your application It provides a simple and flexible way to query and mutate data using GraphQL making it easy to build powerful data driven user interfaces See DocumentationPrerequisitesYou ll need to have some basic knowledge of React and JavaScript Setting up the EnvironmentBefore we get started let s make sure we have the necessary tools and libraries installed We ll be using create react app to create a new React project and Apollo Client to query our GraphQL endpoint npx create react app my appcd my appnpm install apollo client graphql Defining the GraphQL EndpointTo fetch data from a GraphQL API we need to define the endpoint that we ll be making requests to For this example we ll use the following endpoint Setting up Apollo ClientNext we ll set up Apollo Client in our index js file and wrap our App component with the Apollo Provider Our index js file should look like this import ApolloClient InMemoryCache ApolloProvider from apollo client const client new ApolloClient uri cache new InMemoryCache const root ReactDOM createRoot document getElementById root root render lt React StrictMode gt lt ApolloProvider client client gt lt App gt lt ApolloProvider gt lt React StrictMode gt This code creates a new instance of ApolloClient and sets the URI to our GraphQL endpoint It wraps our App in the ApolloProvider passing client object as a prop You might be wondering why uri Uniform Resource Identifier and not url Uniform Resource Locator and that s because in the context of Apollo Client uri refers to the location of the GraphQL server that the client will connect to in order to fetch data This is likely because the URI includes not only the location of the server but also additional details such as the protocol and any query parameters while a URL refers specifically to the location of a resource Creating a Query ComponentNow that we have our GraphQL endpoint and Apollo Client set up we can now fetch data from the API In our App js file paste in the following code import useQuery gql from apollo client const GET LOCATIONS gql query GetLocations country code BR Add your query here name native capital emoji currency languages code name const App gt const loading error data useQuery GET LOCATIONS const name currency capital native emoji languages data country if loading return lt p gt Loading lt p gt if error return lt p gt Error error message lt p gt return lt div key name gt lt h gt Let s Know Our Countries lt h gt lt h gt Country name lt h gt lt br gt lt b gt About this location lt b gt lt ol gt lt li gt Capital is known as capital lt li gt lt li gt Its symbol is emoji lt li gt lt li gt Its native is native lt li gt lt li gt Currency currency lt li gt languages map lang gt lt ol key lang code gt lt li gt Language lang name lt li gt lt li gt Code lang code lt li gt lt ol gt lt ol gt lt div gt export default App This code uses the useQuery hook from Apollo Client to take a GraphQL query as its argument and return an object that contains the data loading and error states for that query In this case the query is defined using the gql template literal function and assigned to a variable called GET LOCATIONS The App component then calls useQuery with GET LOCATIONS as its argument and destructures the resulting loading error and data states The data state is destructured further to get the name currency capital native emoji and languages fields from the GraphQL response It also handles loading and error states and returns the UI to be displayed once the data is loaded Running the ApplicationFinally we can run our application to see the results of our code Run the following command in your terminal npm startThis will start the development server and open up a new tab in your web browser displaying the application It should look like this ConclusionCongratulations In this article we walked through the process of fetching data from a GraphQL API using Apollo Client in our React application and how to handle errors that may occur during the process With this knowledge you can start building powerful data driven user interfaces on your own Happy coding |
2023-02-18 22:12:54 |
Apple |
AppleInsider - Frontpage News |
WhatsApp adds picture-in-picture video calls to iOS app |
https://appleinsider.com/articles/23/02/18/whatsapp-adds-picture-in-picture-video-calls-to-ios-app?utm_medium=rss
|
WhatsApp adds picture in picture video calls to iOS appAn update to WhatsApp has enabled picture in picture mode for video calls bringing the Meta owned messaging service in line with FaceTime for the feature WhatsApp on an iPhone display In December WhatsApp said it was bringing picture in picture to iOS with a beta test of the feature potentially allowing for it to be offered to users in the new year In an update on February the feature finally makes its way to the public Read more |
2023-02-18 22:51:05 |
海外TECH |
Engadget |
WhatsApp is finally adding picture-in-picture support for iOS video calls |
https://www.engadget.com/whatsapp-is-finally-adding-picture-in-picture-support-for-ios-video-calls-223742012.html?src=rss
|
WhatsApp is finally adding picture in picture support for iOS video callsMeta has begun rolling out a major iOS update for WhatsApp Spotted this week by toMac WhatsApp version finally adds picture in picture support for video calls That s a feature iOS users of Meta s chat app have asked for a while and one that as The Verge notes the company began testing at the end of last year As with PiP modes on other platforms WhatsApp will minimize your video call when you look at a different app allowing you to multitask while still seeing the person you re chatting with over the service If you can t access PiP immediately Meta notes the feature and other enhancements introduced with WhatsApp s latest update will roll out “over the coming weeks Speaking of other features WhatsApp also allows you to add captions to documents you send over the app Additionally Meta has tweaked group chat settings allowing you to add longer subjects and descriptions to better describe what your chat groups are all about There s also a new option to create an avatar you can use for your profile photo and stickers |
2023-02-18 22:37:42 |
海外科学 |
NYT > Science |
How Climate Change Is Making Tampons (and Lots of Other Stuff) More Expensive |
https://www.nytimes.com/2023/02/18/climate/climate-change-cotton-tampons.html
|
How Climate Change Is Making Tampons and Lots of Other Stuff More ExpensiveCotton farmers in Texas suffered record losses amid heat and drought last year new data shows It s an example of how global warming is a “secret driver of inflation |
2023-02-18 22:16:14 |
ニュース |
BBC News - Home |
Former US President Jimmy Carter to receive hospice care |
https://www.bbc.co.uk/news/world-us-canada-64691009?at_medium=RSS&at_campaign=KARANGA
|
carter |
2023-02-18 22:40:00 |
コメント
コメントを投稿