Posts

Showing posts from June, 2022

React State vs Props: Introduction & Differences

Image
  What are the Props? Props, which stands for properties, are used to transfer data across components. This data flows from the parent component to the child component in a single direction. Additionally, it should be highlighted that the data transmitted is always read-only and must not be modified. A unique React keyword called “Props” is used to transmit data from component to component. However, the crucial component is the uniform flow of data communication with props. Props data are read-only, so children of elements cannot change their parents’ data. Consider props as objects containing the attributes and their passed-in values from the parent component. Reusing parts is made feasible through props. Pass in props as an argument function Tool ( props ){} Declare props variable: const name = props. name ; Example: 1 Example.js return ( < div > < h1 > My name is { name } . < /h1 > < /div > ) ; App.js import Tool from "./Exa...