Intro to React Hooks and Context API [Webinar Show Notes]
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (182).NET Core  (26).NET MAUI  (234)Angular  (115)ASP.NET  (49)ASP.NET Core  (80)ASP.NET MVC  (85)Azure  (42)Black Friday Deal  (1)Blazor  (243)BoldSign  (15)DocIO  (24)Essential JS 2  (108)Essential Studio  (198)File Formats  (73)Flutter  (141)JavaScript  (227)Microsoft  (121)PDF  (86)Python  (1)React  (107)Streamlit  (1)Succinctly series  (131)Syncfusion  (990)TypeScript  (32)Uno Platform  (3)UWP  (3)Vue  (45)Webinar  (54)Windows Forms  (59)WinUI  (72)Word  (18)WPF  (165)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (11)Business intelligence  (55)Button  (4)C#  (164)Chart  (155)Chart of the week  (62)Cloud  (16)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (74)Development  (697)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (47)Extensions  (31)File Manager  (8)Gantt  (23)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (532)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (48)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (428)Uncategorized  (68)Unix  (2)User interface  (67)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (651)What's new  (355)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Intro to React Hooks and Context API [Webinar Show Notes]

Intro to React Hooks and Context API [Webinar Show Notes]

This blog provides the show notes for our October 19, 2023, webinar, “Intro to React Hooks and Context API.” The webinar was presented and hosted by Khalid Abuhakmeh, developer advocate at JetBrains, and Chad Church, senior sales engineer at Syncfusion. If you missed the webinar or would like to watch it again, the recording is on our YouTube page or you can watch it here.

Overview

This webinar covered the basics of React Hooks (useState) and then demonstrated how to use them with Syncfusion controls. It also covers the difference between prop drilling and the Context API while discussing the pros and cons of each.

Time stamps

[00:00] Introduction

[00:55] Overview of React Hooks

[02:00] What is a Hook?

[03:10] Components prior to Hooks

[04:41] Refactored with Hooks

[06:22] Problem solving

[08:30] Benefits

[10:01] Included Hooks

[11:02] Rules of Hooks

[13:02] React useState vs. Context API

[13:36] Demo Start

[36:00] Closing Notes

Q&A

Q: I am from the classic ASP world and just starting in React. Is context comparable to Session variables?

A: The concept is similar.

Q: Which would be cool for isolated editing?

A: You can use it for isolated editing. In the sample, you could just put the context provider in each function or in the immediate parent. But that is not the intention. 

Q: If we’re using the same component in different tree of components, do I understand correctly that context is different in that case? Each tree has its own context?

A: No. Each function will query its parent going up the tree until it finds a parent with the proper context provider.

Q: Is there a way we can get a copy of the code?

A: Yes, I’ve posted it on this GitHub page.

Q: Can you have multiple contexts declared in a single component?

A: Yes.

Q: So, the suggestion is not to use useState for grids and to use useContext so that if the UI is rerendered, it doesn’t affect the useState?

A: State and context Hooks are complementary features of React. You can use one or both depending on your particular use case and the problems you’re attempting to solve.

Q: Is it correct to update the useState or pass the new variable to .dataSource?

A: useState is the proper way to post an update.

Q: Where do you declare the data format for the context?

A: You don’t really have to set a data type or format. JavaScript is way too flexible in this regard.

Summary

During this webinar, we covered an introduction to React Hooks. We hope you enjoyed this webinar and please keep an eye out for our future React webinars. 

Recommended resources (related links)

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed