React JS

React JS

Test your React JS knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What does JSX stand for in React?

    • JavaScript XML
    • Java Syntax Extension
    • Java Standard XML
    • JSON Syntax Extension
  2. Which command is used to create a new React application?

    • npm create-react
    • react init
    • npx create-react-app my-app
    • npm init react
  3. What is a component in React?

    • A function only
    • A part of HTML
    • A reusable piece of UI
    • A JavaScript variable
  4. Props in React are:

    • Mutable
    • Passed from parent to child
    • Used only in class components
    • Local to the component
  5. Which hook is used to manage state in functional components?

    • useEffect
    • useClass
    • useProps
    • useState
  6. What is the purpose of PropTypes in React?

    • Styling components
    • Enforcing type safety on props
    • Updating state
    • Routing
  7. Which hook is used to manage side effects in functional components?

    • useEffect
    • useState
    • useReducer
    • useMemo
  8. What does useState return?

    • A state value and function to update it
    • Only a function
    • A reducer
    • JSX and props
  9. What is the purpose of useRef?

    • Navigate routes
    • Track DOM nodes or persist mutable values
    • Re-render components
    • Create state
  10. Which is true about controlled components in React?

    • DOM handles form data
    • Form data is handled by React
    • No validation possible
    • Used in class only
  11. What is a Higher-Order Component (HOC) in React?

    • A new React Hook
    • A component enhancer
    • A DOM API
    • A JSX Compiler
  12. Which hook is best for performance optimization in functional components?

    • useState
    • useEffect
    • useCallback
    • useRef
  13. What does React.memo do?

    • Avoids prop drilling
    • Prevents re-renders
    • Adds lifecycle methods
    • Adds delay to rendering
  14. When using Context API, which hook is used to consume context data?

    • useEffect
    • useContext
    • useReducer
    • useCallback
  15. What is the main goal of React Fiber?

    • Server rendering
    • UI design
    • Reconciliation engine rewrite
    • DOM manipulation