
This video will give you an overview about the course.
Often, developers end up repeating the same structure of code unnecessarily. Web components help you resolve the unnecessary replication of code.
• The first step to create a web component is to create a custom element of your own
• To create a custom element, create a class and define a custom hyphenated name for the element
• Add content you want to add to your custom element
For web components, you need to have a DOM tree that cannot be accidentally accessed from the outside. Shadow DOM helps you encapsulate a part of the DOM.
• To create a shadow DOM, you need to access an element and attach shadow to it
• You need to ensure that mode is open so that you can reference shadow outside
• Add HTML and style which can only be accessed by the shadow and not by anyone else
To resolve the problem of rewriting unnecessary code, we need to create a structure which can be reused with different content. HTML Template helps you create a structure which can be reused unlimited times.
• Create HTML code inside a template tag which will not be rendered until called upon
• Copy the template code into a variable using importNode
• Add content as many times as you want and add the content to any part of HTML
To create our blog page, we need two web components – a card for housing all the titles and a modal for showing the content inside the card.
• Create a HTML template which has a title, subtitle, and synopsis elements
• Fetch the content of HTML template and store it in a variable
• Run through data and add it to template’s placeholder elements
Add Shadow DOM and create a custom element to complete our first web component – Card component.
• Create a class for 'card' and define a custom name for it
• Create a shadow root and add template data to the ShadowRoot instance
• Import the custom element in the index.html file and call it
Learn about the different stages and lifecycle in a component’s lifetime.
• Understand the birth, life and death of a web component
• Learn about constructor, connectedCallback and disconnectedCallback
We learnt about the birth, life, and death of a web component. Now, we will see the lifecycle method when component receives updates.
• Understand when and how a component gets updated
• Learn about attributeChangedCallback method of lifecycle
• Learn about adoptedCallback method
Now that we created web components and made it dynamic, we need to make it presentable.
• Add styles to the web component
Adding static styles can lead to lengthy code which cannot be maintained and does not look good. Hence, we need to add styling, dynamically.
• Move styling to an external stylesheet
• Import the stylesheet in our web component
The web components should be able to respond to events like click, hover, keypress, and so on.
• Understand the process of event listening
• Understand how to add event listeners to web components
Apart from traditional onclick, on-hover events, we can also create custom events.
• Create blog-modal, a new web component
• Understand the process of creating a custom event
• Understand the process of dispatching the custom event
Create a custom event and configure it.
• Create a custom event called 'close'
• Add more data into the blog-modal component
• Add finishing touches to the web app
Here, learn how to add animation effects to elements inside the web component.
• Refresh the knowledge of CSS animations
• Understand how to add animations to the web components
• Create a loading icon animation to web component blog-modal
Get a quick understanding of how React JS library works on the principles of components.
• Understand React JS library and its features
• Get a code walkthrough of the library
• Compare web components and React.js
In this video, learn how to integrate our web component blog-modal with a React application.
• Add the HTML template to index.html of React app
• Import web component in the main JS file
• Use web component inside the React component
In this video, learn integrating our web component blog-card with an Angular application.
• Understand Angular and create a basic Angular app
• Create a blog.component.html to store our blog card data of element
• Update app.component.ts and app.module.ts of the Angular app
Here, integrate our web component blog-card with a Vue application.
• Understand Vue and create a basic Vue application
• Copy web component to the Vue application
• Add data and call the web component
This video summarizes the entire course.
As a developer, haven't you often suffered from writing too much code? More often than not, you rewrite the same piece of code for different pages and end up wasting precious time you could have used more productively . . .
In this course, we introduce you to the world of web components, a fairly new concept that has simplified coding for web developers. Web components allow you to create custom and reusable HTML tags that will work across modern web browsers and can be used with any JavaScript library or web framework that works with HTML.
After working through this course, you will be ready to develop production-ready web component applications! You will be able to build your own custom components that can be reused again and again. Moreover, you will also be able to share your custom components with other developers.
To benefit fully from this course, you need to have at least a basic idea of ES6 concepts such as const, let, classes, map, filters, and so on. A basic understanding of JavaScript frameworks such as Angular, React, and Vue would be beneficial in order to gain a full understanding of web component integration aspects.
About the Author
Rushabh Shah is a seasoned UI developer working in an exciting start-up based out of Mumbai. He is one of the founding members of the company and also the Senior UI Developer there. Rushabh has worked on a variety of projects across different frameworks and software architectures. His forte lies in creating web applications and user-friendly dashboards using reusable component-friendly library like React along with the latest developments in the traditional web development technologies.
Rushabh has previously worked with major companies like Capgemini India Pvt. Ltd. and Fractal Analytics and has a rich experience in developing web applications for clients like Ernst Young, Procter & Gamble (P&G), Colgate Palmolive, Reckitt Benckiser, and Indian Navy before venturing into the product domain with companies like Cuddle .ai and later Eugenie .ai (of which he is a founding member). He has also curated articles and tutorials for web development.
Having been the sole developer for a major chunk in his career, he understands the need to gain the right and efficient knowledge from the vast ocean that is, the World Wide Web. Additionally, having worked with industry stalwarts later in his career, he knows the best practices to be used for creating web tools.