Blog

What is the purpose of react router?

Answer:React Router plays an important role to display multiple views in a single page application. Without React Router, it is not possible to display multiple views in React applications. Most of the social media websites like Facebook, Instagram uses React Router for rendering multiple views.

How does context api works?

Answer:The React.createContext is all you need. Provider is a component that as it's names suggests provides the state to its children. Consumer as it so happens is a component that consumes and uses the state.

how UseRef hook works?

Answer:The useRef Hook allows you to persist values between renders. It can be used to store a mutable value that does not cause a re-render when updated. It can be used to access a DOM element directly. useRef() only returns one item. It returns an Object called current.