Skip to content

Conversation

@aisha0320
Copy link
Collaborator

No description provided.

const ProgressBar:FC<ProgressBarProps>=({onComplete, color = "#0000FF", duration = 5000})=> {
const [progress, setProgress] = useState(0);
const step = 100/(duration/50);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step calculation isn't required. Also use useRef for storing setInterval

setUsers(result)
})
} else {
throw new Error(`HTTP error! Status: ${response.status}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set the error here too, instead of throwing the error.

//status code
// we got the response
response.status
response.json().then(result => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to capture the error for this json parsing too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants