how to use top-loading-bar
Using npm :-
npm i top-loading-bar
Using yarn :-
yarn add top-loading-bar
How to use this :-
With ref :-
import React, { useRef } from 'react'
import LoadingBar from 'top-loading-bar/dist'
const App = () => {
const ref = useRef(null)
return (
ref.current.continuousStart()}>
Start Continuous Loading Bar
ref.current.staticStart()}>
Start Static Loading Bar
ref.current.complete()}>Complete
)
}
export default App
With state :-
import React, { useState } from 'react'
import LoadingBar from 'top-loading-bar/dist'
const App = () => {
const [progress, setProgress] = useState(0)
return (