Create Reusable library in LWC

In Lightning Web component, we can create component with and without HTML template. Component without HTML template is called Service Component or Service Libraries. Service Component can be created for reusable functions, which can be used in other LWC component.
This post will explain how we can create Service Component which will be used in other component. This component has below functions.

LOGO_URL – Which wll provide Logo Url for application
showMessage – This function will show toast message.
isValidForm – This function will check validity of each field on page
validateEmail – This function will validate Email
validateDOB – This function will validate that Date of Birth is not a future date

There can be another methods as well which can be added to support other LWC component like date comparison, value comparison etc.


Checkout step by step guide here to create reusable guide at creating reusable component in LWC

Comments

Popular posts from this blog

Dynamic Formula Evaluation in Salesforce

What Salesforce Admin do as daily work?

Salesforce Admin Jobs for Freshers