AWD Questions
AWD Questions
Points to Note:
Props are immutable so we cannot modify the props from inside the
component. Inside the components, we can add attributes called props.
These attributes are available in the component as this.props and can be
used to render dynamic data in our render method.
When you need immutable data in the component, you have to add props
to reactDom.render() method in the main.js file of your ReactJS project
and used it inside the component in which you need. It can be explained
in the below example.
Props
Props are read-only components. It is an object which stores the value of
attributes of a tag and work similar to the HTML attributes. It allows
passing data from one component to other components. It is similar to
function arguments and can be passed to the component the same way
as arguments passed in a function. Props are immutable so we cannot
modify the props from inside the component.
React Refs
Refs is the shorthand used for references in React. It is similar to keys in
React. It is an attribute which makes it possible to store a reference to
particular DOM nodes or React elements. It provides a way to access
React DOM nodes or React elements and how to interact with it. It is used
when we want to change the value of a child component, without making
the use of props.