Using Web Components in a React Application
A Web Component tutorial is presented, focusing on integrating custom components and widgets into a React application. The tutorial requires a Vonage API account and utilizes the keypad component from a previous post, along with a contacts list component that can save and load names and phone numbers to local storage. Issues with passing data to the web components are discussed, including stringification of arrays and objects, and how React handles events. Solutions for these issues are proposed, including using properties to pass data and creating custom event listeners. The tutorial also covers how to create a basic React "App" component, place Web Components inside it, and handle events and data using different methods, such as class components, function components with hooks, and the useRef hook. Finally, the tutorial demonstrates how to make an in-app voice call using Nexmo CLI and integrates the Web Components into the application.
Company
Vonage
Date published
May 10, 2021
Author(s)
Dwane Hemmings
Word count
1988
Language
English
Hacker News points
None found.