August 26, 2022

Mutiple ways to programmatically navigate using React router

 Mutliple ways to navigate between pages in react using react router. 

  • React Router v6
            useNavigate hook can be used.
 
  import { useNavigate } from "react-router-dom"
  const Component = () => {
      let navigate = useNavigate();
      navigate("/pathname", state: { someData }); 
  }

  • React Router v5
            useHistory hook can be used.
 
  import { useHistory } from "react-router-dom"
  const Component = () => {
      let history = useHistory();
      history.push("/pathname"); 
  }


June 24, 2021

React JS Interview Questions and topics

 To evaluate a candidate, recruiters generally asks certain questions so that they can know how much the candidate has hands-on experience and how much is his/her technical capabilities. Below are some of the questions:

  • What is Virtual DOM?
  • Explain how React Routing works?
  • What are the ways to debug React JS application?
  • What are the libraries needed for unit testing. Write a sample unit test.
  • How to configure application so that whenever an user commits code, it first checks the code alignments and other lint issues and fix them automatically.
  • How to configure application so that whenever user pushes code to source control, it first run all unit test cases and on success only it pushes the code to the repo
  • What is Responsize web design?
  • How does Exception Handling works,
  • What type of configuration needed to deploy an react application on mulitple environments.
  • How to maintain configuration data like API URLs, API Keys etc based on different environments in application.
  • Difference between const and let. Write an example.
  • Difference between == and ===, write an example.
  • what is use of pre commit and post commit in package.json?
  • Difference between ES6 functions like filter and find.
  • How to configure redux in the application.
  • How to access lifecycle methods in functional components.
  • Which lifecycle methods we can access using useEffect hook.
  • How and where we can use Spread Operator?
  • What is the use of JWT token and how does it works.