Тёмный

React With GraphQL (Apollo Client) Crash Course 

Laith Academy
Подписаться 73 тыс.
Просмотров 86 тыс.
50% 1

In this video, we will learn how we can connect a client-side application with a graphql server. We will use Apollo Client to connect a React app to a Rick and Morty GraphQL API
Second Channel:
/ @laiture123
Rick and Morty GraphQL API
rickandmortyapi.com/graphql
Udemy Courses :
www.udemy.com/course/modern-g...
Timeline:
0:00 - GraphQL 101
8:27 - Connection React to GraphQL
14:14 - Writing a Query
29:23 - Creating a Query Hook
31:57 - Queries with Variables
47:05 - Lazy Queries
59:55 - Mutations

Опубликовано:

 

26 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 128   
@SimPwear84
@SimPwear84 2 года назад
I watched and practiced most of your videos. Lost of coding-along, frustration and doubts. It all finally cemented into my brain and I breezed through my coding test. Just want to let you know that you upgraded my life 😭😭😭😭
@abdurrahmanahmed7057
@abdurrahmanahmed7057 Год назад
nah dude you upgraded your life, he just helped!
@bagusamrullah4371
@bagusamrullah4371 2 года назад
Enjoy this course so much, easy to understand! Thank you once again Laith =))
@uncleiroh3616
@uncleiroh3616 Год назад
The way you explain it is just so stunning. It’s simplified at its finest. Very 👍🏻
@riazmahom9770
@riazmahom9770 11 месяцев назад
This is the best GraphQL coding-along video I have seen thus far and I am convinced to use it now.😜
@pamflet9493
@pamflet9493 2 года назад
Your channel is so underrated. Thanks for all your courses
@billy-bund
@billy-bund Год назад
You're very good at explaining things in an easy to understand way
@bamii_a
@bamii_a 2 года назад
The crash course I didn't know I needed 💯
@awara6984
@awara6984 2 года назад
I understood more of GrraphQL and Apollo from your video, Thank you
@maroueneayoub1133
@maroueneayoub1133 2 года назад
just at the right moment , I'm starting a new project and i'll need to learn graphQl. good mind reader
@ari.joel.m
@ari.joel.m 2 года назад
Thank you for making these videos!
@rounakbhattacherje3426
@rounakbhattacherje3426 11 месяцев назад
very easy and very practically explained, great work- loved it👍
@priyeshjammula854
@priyeshjammula854 Год назад
A great one to start with. Fewer jargons and clear explanation.
@0xAndy
@0xAndy Год назад
Fantastic. Just what I needed.
@keshavsharma-vx8ni
@keshavsharma-vx8ni Год назад
one hell of a tutoarial bro it clicked in one shot thanks a lot
@griftegrd
@griftegrd 2 года назад
Great content, I was able to replicate it with my django graphql endpoint after a few adjustments (mostly datatypes and the react router dom v6 changes). Thank you so much.
@FaisalAmin001
@FaisalAmin001 Год назад
Thank you ❤👏👏 You made the GraphQL sooo easy
@rileynobles7146
@rileynobles7146 2 года назад
Great job and staying on task and keeping it simple.
@judoScott
@judoScott 2 года назад
Great tutorial. Thank so much!
@roisx
@roisx Год назад
I am so happy that I found your Crash Course because I am so lazy to see courses with higher hours. 😅. This was such a valuable and short course learned... Thank you so much...
@brajagopal4725
@brajagopal4725 4 месяца назад
Best React With GraphQL crash course in RU-vid❤
@iUmerFarooq
@iUmerFarooq 2 года назад
You're doing great bro 👊
@zillboy
@zillboy Год назад
Really amazing crash crouse, thanks Laith Academy.
@SaurabhNative
@SaurabhNative 2 года назад
This is a great tutorial. Learnt about the basics of GraphQL pretty quickly. Thanks a lot.
@redm1n272
@redm1n272 Год назад
This video really helped me. Thank you very much!
@bayasahamed1815
@bayasahamed1815 6 месяцев назад
It's simple and informative. Thanks!!
@codingcafe8360
@codingcafe8360 5 месяцев назад
Amazing course to Learn GQL, Thanks to you 💜
@frontendonly
@frontendonly 2 года назад
You makes it easy to me now i'm start to learn it,thanks
@ikechukwuunegbu7266
@ikechukwuunegbu7266 Год назад
Thank you bro. This is really great. I will take it from here with apollo documentation
@orubenlopes
@orubenlopes 2 года назад
Liking before watching!
@yaldakarimi3772
@yaldakarimi3772 2 года назад
Great crash course, thanks
@gmjitendra
@gmjitendra 6 месяцев назад
Excellent. Thank you so much.
@kresimirjurkovic9608
@kresimirjurkovic9608 2 года назад
Yo bro, this was fucking fantastic! When your course drops in price (due to my lack of money atm), buying it for sure!
@dananjayachathuranga7113
@dananjayachathuranga7113 Год назад
this is the best video for learn graphql client
@adelmohamedtadjerouni2418
@adelmohamedtadjerouni2418 Год назад
thanks, that was exactly what i was looking for, just note , i think even a lazy query can be in a separate custom hook
@lanecunningham3759
@lanecunningham3759 2 года назад
Fantastic free content! Thank you! I just bought your Udemy course. Looking forward to starting it.
@pawelczar
@pawelczar Год назад
Hey @Lane Cunningham. Can you say which course have you bought and share your opinion about it. I really like the way how he teaches and considering buy one of his courses as well. Thanks :)
@nwobodogeorge5370
@nwobodogeorge5370 2 года назад
Thanks bro. You made my day
@ndanzzid566
@ndanzzid566 2 года назад
great explanation!
@mickaelrichard7255
@mickaelrichard7255 2 года назад
Was just coming back to watch your older graphql tuto and I see this :D Is there any chance that you will do some graphql with redux tuto in the futur?
@siavoshoon
@siavoshoon Год назад
It was very helpful. Thank you. ⭐⭐⭐⭐⭐
@ai_coding
@ai_coding Год назад
awesome learned a lot thank you.
@takayumaja9438
@takayumaja9438 2 года назад
Thanks for your tutorial brother
@sunnymishra6500
@sunnymishra6500 2 года назад
really helpful video thnks mate
@rashedulalam7754
@rashedulalam7754 2 года назад
Great content ,Thank you
@user-jx8ob6jp6w
@user-jx8ob6jp6w 2 года назад
Splendid job
@NeoCoding
@NeoCoding 2 года назад
enjoyed the lesson thank u
@juhandvan
@juhandvan Год назад
Good Practice !
@andrews13
@andrews13 Год назад
Perfect!
@stephl9961
@stephl9961 2 года назад
THANK YOU SO MUCH!
@rafael7425
@rafael7425 2 года назад
nice man!
@aqibfayyaz1619
@aqibfayyaz1619 Год назад
Awesome.
@dennisgonzales9521
@dennisgonzales9521 2 года назад
Thankyou so much!
@dzhaniivanov5837
@dzhaniivanov5837 Год назад
good explanations ,keep going.the udemy course is with actual tech stack till now ?do u think to update it soon?
@shanglee643
@shanglee643 2 года назад
dude is a god developer!!!
@yusufabdulla6018
@yusufabdulla6018 2 года назад
Thank you so much
@mohamedramsey8352
@mohamedramsey8352 Год назад
Great work, this is really helpful. My question here is how to get the actual error from graphql
@physcript2436
@physcript2436 2 года назад
good one
@sanusivictorolajuwon514
@sanusivictorolajuwon514 2 года назад
Great work Sir. When should we be expecting a Vue version? Thanks 😊.
@sourabhvaishnav8235
@sourabhvaishnav8235 Год назад
The bouy did the job.!
@MrAhvids
@MrAhvids 2 года назад
I'd love to see subscriptions sometime soon.
@mD-mp8bb
@mD-mp8bb 2 года назад
Thanks, make video about graphql type autogen for typescript.
@Nico-sb5qs
@Nico-sb5qs 2 года назад
nice
@arunavamukherjee7549
@arunavamukherjee7549 2 года назад
Awesome video. Small problem. When calling the useCharacters() @31.37, error message saying " export 'useCharacters' (imported as 'useCharacters') was not found in '../hooks/useCharacters' (possible exports: default)". And I followed exactly to the video. I checked 20 times lol but same problem. Any suggestions?
@tsmmith9252
@tsmmith9252 2 года назад
hi laith , if possible could you make a aws s3 crash course like you did for lambda?
@martynamichno2401
@martynamichno2401 2 года назад
Could you tell, why we don't use hooks when it comes to lazy queries? Is about this array returning from this function instead of object?
@bagusamrullah4371
@bagusamrullah4371 2 года назад
Hi Laith, may i request WebSocket crash course ? It feel little bit complicated as i learn it, wonder if you can make it easier just like any other crash course! Thank you very much
@_rachid
@_rachid 2 года назад
Merci.
@SouthIndianLifeAustralia
@SouthIndianLifeAustralia 2 года назад
The one using LazyQuery is messed up, if you go backspace in search box, the state is constantly re-rendering because of using data &&.
@mickaelrichard7255
@mickaelrichard7255 2 года назад
If you do a udemy course on graphql I will be the first to buy it! Btw do you already have an udemy channel with some courses by any chance?
@murat6018
@murat6018 Год назад
2023 update: Don't use Switch, write your code like this => {" "} {" "} {" "}
@rekameszaros1753
@rekameszaros1753 Год назад
Do you know why do I still get the error: import Routes '"react-router-dom"' has no exported member named 'Routes'. Did you mean 'Route'?ts(2724) Even if I did this command; npm install react-router-dom@latest ? and also imported: import { Route, Routes } from "react-router-dom";
@murat6018
@murat6018 Год назад
@@rekameszaros1753 Are you coding in JS or TS?
@igorr4682
@igorr4682 2 года назад
This kind of reminds me of React Query or RWS in Next Js
@milon27
@milon27 2 года назад
won't we need to call use query inside useEffect hook?
@Atif1702
@Atif1702 2 года назад
Great content as always 👏🏻 I am confused about caching concept in Apollo Client, can you please clear one doubt. API response is stored in cache and from there it is served to the app. But how does the cache stays up to date with latest data from backend? Does it send some network requests in background? If so, then isn't that costly because we are sending unnecessary requests and may be the data doesn't change that often at backend but we are continuously sending API requests? Can you please clear that how the cache stays up-to-date and how does the Apollo client knows when to fetch data from cache and when from the server?
@laithacademy
@laithacademy 2 года назад
When your data changes, like in a mutation, you can actually request Apollo to reset the cache. Ben has a good video on this: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-lQ7t20gFR14.html
@Atif1702
@Atif1702 2 года назад
@@laithacademy Thank you so much for getting back. My question is a little different. Let's suppose no mutation happens from the app. Data is returned from the cache if the cache has the data. But how does Apollo client ensures that there is always updated data in cache?
@laithacademy
@laithacademy 2 года назад
@@Atif1702 Typically this is handled in one of two ways. Either you sync the cache with the updated data or you run a cron job (every 15min let's say) that makes a request to the backend and puts that data in the cache instead. If you have many users in your application, the requests the cache saves you far exceeds the requests you would do on the job
@Atif1702
@Atif1702 2 года назад
@@laithacademy Thanks 😊
@soltiscd
@soltiscd 2 года назад
I'll buy your graphql course!
@laithacademy
@laithacademy 2 года назад
coming soon!!
@soltiscd
@soltiscd 2 года назад
@@laithacademy you better not use Hasura on the backend... hint hint
@c.toobitz7566
@c.toobitz7566 2 года назад
Any way to make this work with class components?
@lobsanggyatso6280
@lobsanggyatso6280 Год назад
can you please tell me how to do price range query
@physcript2436
@physcript2436 2 года назад
subscription broadcast apollo with react and gql
@toannew
@toannew 11 месяцев назад
10:31 connect react with graphql server through Apollo-Client 13:06: InMemoryCache: cache the query into cache for next API calls 18:32 how to qeury from Graphql server
@rajathvp
@rajathvp 2 года назад
NOTE - React Router version has been updated now.- If you use as shown @35:00 then the render wont display. Please use a previous version of React Router like 5.2.0 to see this working correctly
@yusuf2025
@yusuf2025 2 года назад
Yes. but instead using the previous version, you can change to as react-router-dom defined when you import it first
@delias1yt
@delias1yt 3 месяца назад
very good tutorial!!! can you please give the link to code?
@kritikadhuria8542
@kritikadhuria8542 2 года назад
Where is the link to udemy course?
@nicholasdrew4937
@nicholasdrew4937 2 года назад
Question about the lazy querying. I can see that the query was---at first---delayed until we actually selected the "Search" button. However, after you selected it once, it looked like the query was getting executed just when you changed the input and no longer needed to select the "Search" button. For example, ~59 minutes in when you change it from Annie -> Rick Sanchez. Can you explain what's going on here?
@jadefariscal3724
@jadefariscal3724 2 года назад
Nice question. The reason was he use the useState Hook. If the property "name" is changed in value, the component wil re-render itself. He used the search bar onchange function that's why it triggers to change the value "name". Because name is linked to the name property. If you care for performance don't do his way. There are some techniques that you can do to make it more efficient. Overall there are no mistake on his code. I hope this help
@abbasdahodwala7248
@abbasdahodwala7248 Год назад
hey, i had same doubt that behavior kind of makes sense if you think about it. i have found the right method getLocations({ variables: { name } }); instead of passing variable object to hook, pass it when you actually want to call the query. and it will work as expected. its been long but I'm posting it if anyone else might have same doubt.
@preetianand3282
@preetianand3282 5 месяцев назад
Why can't I see 'SCHEMA' and 'DOCS' option on right?
@tekinatawar1713
@tekinatawar1713 2 года назад
In the end you said something like " There is a a great reason not to use custom hooks for useLazyQuery, but you didn't explain it". So, can someone explain that.
@moazamdev
@moazamdev 9 месяцев назад
Started like its a tutorial by Traversy Academy because of the intro.
@Boyarsskiy
@Boyarsskiy Год назад
Thank you very much! But I have a question: how to prevent the search method from being called every time I type a letter in the text field?
@Boyarsskiy
@Boyarsskiy Год назад
I found a solution: just added a reference to the input field: "const inputRef = useRef();" And then changed state after button click using input field reference: "setName(inputRef.current.value);" I don't know if this is the ideal solution (I'm Java-backender and new in React), but it works for me: import {useRef, useState} from "react"; import {gql, useLazyQuery} from "@apollo/client"; const GET_CHARACTER_LOCATIONS = gql` query GetCharacterLocations($name: String!){ characters(filter: {name: $name}) { results { location { name } } } } `; export default function Search() { const [name, setName] = useState(); const inputRef = useRef(); const [getLocations, {loading, data, error, called}] = useLazyQuery(GET_CHARACTER_LOCATIONS, { variables: { name, } }); const handleSearch = () => { setName(inputRef.current.value); getLocations(); } console.log(loading, data, error, called); return ( Search {loading && spinner...} {error && something went wrong} {data && ( {data.characters.results.map((character) => { return {character.location.name} })} )} ); }
@jordannlegal6161
@jordannlegal6161 Год назад
I followed the tutorial step by step but my search page is not working properly....When clicking on search the locations don't appear, but when I delete a letter, the query is launched....Can you help ?
@shoibalhossain824
@shoibalhossain824 2 года назад
please wrap it all.
@johndavemanuel9603
@johndavemanuel9603 2 года назад
where we can find the source code?
@ridl27
@ridl27 2 года назад
code pls ?!
@taunado
@taunado Год назад
Is this relevant for Next 13 too? Or outdated?
@StevanMedic
@StevanMedic Год назад
Great to listen at 1.5x speed
@pratikwadekar4981
@pratikwadekar4981 2 года назад
Can GraphQL be used with a REST server which is not a GraphQL server ?
@laithacademy
@laithacademy 2 года назад
Absolutely, GraphQL is typically paired with multiple REST microservices
@pratikwadekar4981
@pratikwadekar4981 2 года назад
@@laithacademy So we need to build a Facade like pattern , wherein we have GraphQL server that deals with RESTful calls and sends back the data. Correct me if I am wrong.
@ABUTAHER-wg7gz
@ABUTAHER-wg7gz Год назад
unexpected apollo client api calling, like- i got a id form react useParam, it should be call frist time only but if change any other state, gql query calling api every time
@essienabasiama2011
@essienabasiama2011 Год назад
i folowed exactly what you did, yet, am havung this error "Missing field 'token' while writing result {}", Its really fustrating, Kindly help me out with it
@laithacademy
@laithacademy Год назад
I need to see the code
@reilwaystation9511
@reilwaystation9511 2 года назад
Next how to use apollo cache as replacement for redux
@zaurmahmudov1438
@zaurmahmudov1438 2 года назад
Apollo be like: " I will bring PHP in every language"
@chaddeveloper6990
@chaddeveloper6990 2 года назад
28:50
@andrews13
@andrews13 Год назад
Source code?
@chaddeveloper6990
@chaddeveloper6990 2 года назад
10:30
@coding2490
@coding2490 Год назад
35 minutes
Далее
React with Redux Toolkit Crash Course
1:09:05
Просмотров 98 тыс.
Learn GraphQL In 40 Minutes
39:43
Просмотров 730 тыс.
Mama Bear Helps Babies Across Road
00:30
Просмотров 1,7 млн
The Microfrontend Crash Course
57:27
Просмотров 32 тыс.
Redux не нужен. GraphQL и Apollo Client.
27:48
React Redux (with Hooks) Crash Course
48:00
Просмотров 208 тыс.
GraphQL Crash course | easy way
45:57
Просмотров 112 тыс.
GraphQL Crash Course
2:59:54
Просмотров 40 тыс.