diff --git a/react/react-reels-downloader/App.js b/react/react-reels-downloader/App.js new file mode 100644 index 0000000..af5a190 --- /dev/null +++ b/react/react-reels-downloader/App.js @@ -0,0 +1,58 @@ +//test Url https://www.instagram.com/reel/CvzvzCQNR9J/?igshid=MzRlODBiNWFlZA== +// App.js +import React, { useState } from 'react'; +import { downloadInstagramVideo } from './api'; +import './index.css'; +import Loader from './Loader'; + +function App() { + const [videoUrl, setVideoUrl] = useState(''); + const [videoData, setVideoData] = useState(null); + const [isLoading, setIsLoading] = useState(false); + + const handleDownload = async () => { + if (videoUrl) { + setIsLoading(true); + try { + const data = await downloadInstagramVideo(videoUrl); + setVideoData(data); + } catch (error) { + console.error(error); + } + setIsLoading(false); + } + }; + + return ( +
+ + // This video url will expire in Aug 15, 2023. + // feel free to remove it or replace it with your own. +
+

Instagram Reel Video Downloader

+ setVideoUrl(e.target.value)} + /> + {isLoading ? ( +
+ ) : ( + videoData && ( +
+ +
+ ) + )} + +
+
+ ); +} + +export default App;