Skip to content
Discussion options

You must be logged in to vote

To add a progress bar:
1. In src/app-components/files.js, use XMLHttpRequest for uploads:
javascript<br>const [progress, setProgress] = useState(0);<br>const uploadFile = (file) => {<br> const xhr = new XMLHttpRequest();<br> xhr.upload.onprogress = (e) => setProgress((e.loaded / e.total) * 100);<br> xhr.open('POST', '/api/files/upload');<br> xhr.send(file);<br>};<br>
2. Render a progress bar with Tailwind CSS.
3. Test with npm run dev.
4. Submit a pull request.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by IsmailBinMujeeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants