REACTJS(NOTES-PDF)
REACTJS(NOTES-PDF)
i work at {company}
Count: {count}
My salary is {salary}
is Availble: {isAvailable)
{/* here it will not print true because we know that boolean null or undefined will not be printed on the UI , boolean we can use for conditional rendering purpose */}{ isAvailable?'yes i am available''i am not available'}
{isNull null ? "loading" : "some content")
{isUndefined "we got content!"}
indefined ? "loading with undefined data" :My salary is (salary)
is Available: {isAvailable}
{""}(isAvailable ? "yes i am available" : "i am not available")
{isNul null ? "loading" : "some content")
{isUndefined =: "we got content!"}
= undefined? "loading with undefined data":{obj.description}
export default Child Default Props: — In React, default props allow you to specify default values for props that a component might not receive.— Generally, Props are used to share information between components and it helps to component reusability by passing different props. — What if a component was made with some prop data and that prop was not present. - So, we are able to decide what if the prop is not present. - Now the solution is passing default props. ~ If the data has not been sent then the component will consider this data. ~ The defaultProps is a react property that allows you to set default values for props objects. - Example: const Parent return (Name is {name}
Name is {company}
Name is {salary}
Name is {name || "Shubham"}
Name is {company || "Test Yantra"}
Name is {salary || 800000}
Name is {name}
Name is {company}
Name is (salary}