Category: React
-
React Conditional Rendering
In React, we can create multiple components which encapsulate behavior that we need. After that, we can render them depending on some conditions or the state of our application. In other words, based on one or several conditions, a component decides which elements it will return. In React, conditional rendering works the same way as…
-
React Events
An event is an action that could be triggered as a result of the user action or system generated event. For example, a mouse click, loading of a web page, pressing a key, window resizes, and other interactions are called events. React has its own event handling system which is very similar to handling events…
-
React Controlled Vs. Uncontrolled Component
Controlled Component A controlled component is bound to a value, and its changes will be handled in code by using event-based callbacks. Here, the input form element is handled by the react itself rather than the DOM. In this, the mutable state is kept in the state property and will be updated only with setState() method.…
-
React Forms
Forms are an integral part of any modern web application. It allows the users to interact with the application as well as gather information from the users. Forms can perform many tasks that depend on the nature of your business requirements and logic such as authentication of the user, adding user, searching, filtering, booking, ordering,…
-
React Component Life-Cycle
In ReactJS, every component creation process involves various lifecycle methods. These lifecycle methods are termed as component’s lifecycle. These lifecycle methods are not very complicated and called at various points during a component’s life. The lifecycle of the component is divided into four phases. They are: Each phase contains some lifecycle methods that are specific to…
-
React Component API
ReactJS component is a top-level API. It makes the code completely individual and reusable in the application. It includes various methods for: Here, we are going to explain the three most important methods available in the React component API. setState() This method is used to update the state of the component. This method does not…
-
What is Constructor?
The constructor is a method used to initialize an object’s state in a class. It automatically called during the creation of an object in a class. The concept of a constructor is the same in React. The constructor in a React component is called before the component is mounted. When you implement the constructor for…
-
State Vs. Props
State The state is an updatable structure that is used to contain data or information about the component and can change over time. The change in state can happen as a response to user action or system event. It is the heart of the react component which determines the behavior of the component and how…
-
React Props Validation
Props are an important mechanism for passing the read-only attributes to React components. The props are usually required to use correctly in the component. If it is not used correctly, the components may not behave as expected. Hence, it is required to use props validation in improving react components. Props validation is a tool that will help the developers…
-
React Props
Props stand for “Properties.” They 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 gives a way to pass data from one component to other components. It is similar to function arguments. Props are passed to the component in the same way…