 Hello everyone, I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate you the difference between private and public property. So in my previous video, I explained you about decorators. So we learned about AdWrit API decorators. So I'm going to give you a demonstration like how AdWrit API will be useful and what happens if we don't use AdWrit API decorator. So I'm jumping to VS code and here like initially we created a project, Sanjay Gupta Tech School and I will be creating all the demonstration like all the LWC in this project only. So till now I showed you two demonstrations. So these two folders are available here. Now I'm going to create one more. So I'm going to right click and from here I'm selecting create lightning web component. So in this component, I'm going to show you the property behavior. So naming it as pryProp demo. So here you can see this component is created and here we have HTML file. So here in the JavaScript file, first of all, I'm going to create two properties. So first I'm creating named as masses and in this property I'm writing private property and another I'm creating as record ID. So these two properties I created and right now I'm going to demo you like how private properties works in lightning web component and how we will be converting these private properties into public property. So in this JavaScript file, I created these two properties. Now, if I want to render values of these properties on the UI, so I need to go to HTML file. So first of all, I'm going to save this and I'm going to open HTML file. So here inside dev, I'm going to display these. So message and that I can display with the help of this masses property. So whenever you want to render any property on the UI, you need to enclose it in curly base. So I have another dev and here I'm going to show the ID of record with the help of the pod ID property. So these two properties will be rendered on the UI with the help of this HTML file. So if I open the JavaScript file, so you can see both are directly declared without any decorator. So if you want to locally use any property or any variable in your lightning web component, so you don't need to use any decorator. It will be by default private for that lightning web component. Now I'm going to give you a demo like, what is the meaning of private? So if I place this lightning web component on the record page of particular object, so I will try to pass the idea of that particular record into this record ID variable, but I won't be able to do that because it is a private property and I can't expose this property outside this lightning web component. Okay, so before deploying this component to the org, I need to modify this file. So here it is true and I'm going to copy some code from existing files. So I'm copying these targets and I'm pasting them over here and I'm just removing this homepage because I just want this component to be placed on the record page, right? So this way all three files are created. So this is JavaScript file which is having two properties, both are private. Then we have this XML file here is exposed as true and this component can be placed on record page. And then we have HTML file where masses property and the record ID property will be rendered on the UI. So now I'm going to deploy this component to the org. So it is being deployed. Once it is deployed, then I will be able to place this component on the record page. So it is deployed now. Now I'm jumping to the org and I'm going to open the sales application. So I'm jumping to accounts tab and the opening particular account record and I'm going to add it to the page. So all the custom components are available at the bottom. So you can see type of demo is available here. If I drag and drop it. So here you can see messages displayed as private property but report ID is blank. And here we don't have any option to pass the value as well, right? So I'm just clicking on save and moving back. So this component will be available on each account record and it will show message as private property and then record ID will be blank because record ID property is private. It is not exposed for outside use and similarly message is also private but we provided some value to masses. That is why it is showing some value but record ID is not showing anything. So now what I'm going to do, I'm just converting this to public property and here I'm going to use at the rate API before record ID, right? As you use at the rate API before the record ID so you need to do one more change. You need to import it. So in the first line along with lightning element you need to import API functionality, right? And then you will be able to use at the rate API decorator. Now this record ID became public property but masses is still private property. Although it will display public property but it is a masses. So masses is still a private property and record ID has become the public property. Now XML file will remain same and HTML file will remain same. So I just saved the JavaScript file. Now I'm going to deploy this component again so that whatever changes we did in the JavaScript file so those will be available in the org as well. Now I'm going to refresh the page and here you can see record ID is displayed here, right? So automatically that property is exposed and it is fetching the record ID. So if I added this page once and if I click on this component, right? So here also you can see both public property masses and record ID, this ID value is displayed here, right? So whenever you want to fetch ID of particular record in your lighting web component, so what you can do, you can just create a public property named as record ID. Always remember it should be named as record ID because it is automatically identified by the record page and the current record ID will be stored in this record ID property. If it is declared as ad-rate API, like public property, okay? Now if I go to any other account record, so you can randomly open any account record and you will see the message as well as record ID value. So this way I hope you understood the difference between private and public property. So if you want to expose any property outside lighting web component, so in that case, you can annotate that property as ad-rate API with ad-rate API decorator. So it will become the public property and if you don't put any decorator, so that property will become the private property. So that private property you can use inside lighting web component on. So I hope with this demonstration, you understood the difference between private versus public property. So this is all about I demonstrated in this video. So thank you.