Questions & Answers

Q-1:What is the differences between uncontrolled and controlled components?

Uncontrolled components are input elements that manage their own state internally, while controlled components are input elements that are fully controlled by the web application. The choice between using uncontrolled or controlled components depends on the specific needs of the web application and the functionality of the input element in question.

Q-2:How to validate React props using PropTypes?

    PropTypes is a useful library for validating the props passed to our React components. By using PropTypes, we can catch errors early and ensure that your components are used correctly.Here are some common PropTypes that you can use to validate your props:
  • PropTypes.string: validates that the prop is a string
  • PropTypes.bool: validates that the prop is a boolean.
  • PropTypes.array: validates that the prop is an array.

Q-3:What is the difference between nodejs and express js?

    Node.js and Express.js are both JavaScript-based web development technologies, but they serve different purposes.Some differences:
  1. I.Node.js is a runtime environment, while Express.js is a web framework for Node.js.
  2. II.Node.js provides low-level access to system-level features, while Express.js provides a higher-level abstraction for building web applications.
  3. III.Node.js has a modular architecture, while Express.js provides a more opinionated approach to web development.
  4. IV.Node.js can be used to build a wide range of applications, while Express.js is primarily focused on building web applications and APIs.

Q-4:What is a custom hook, and why will you create a custom hook?

Custom hooks in react are like reusable functions. Custom hooks can be used to handle common concerns like fetching data, managing state, and interacting with APIs. By using custom hooks,we can reduce code duplication and improve the overall organization and maintainability of our code.