Download NetflixClone/src/components/StaticPages/ErrorPage/ErrorPage.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 944 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/NetflixClone/src/components/StaticPages/ErrorPage/ErrorPage.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/NetflixClone/src/components/StaticPages/ErrorPage/ErrorPage.js
-
curl -L -o ErrorPage.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/NetflixClone/src/components/StaticPages/ErrorPage/ErrorPage.js
944 Bytes
| import React from 'react' | |
| import './ErrorPage.css' | |
| /** | |
| * I have to check for error message or simply an error because of I've handled errors in the | |
| * reducers. The RTK documentation recommends checking for a promise rejection with value or | |
| * with an error; thus, when it rejects with value, there will be a status_message, and if that | |
| * doesn't happen, there will simply be an error object | |
| */ | |
| const ErrorPage = props => { | |
| const { errors } = props | |
| let errorObjs | |
| if (Array.isArray(errors)) { | |
| errorObjs = errors[0] || errors[1] || errors[2] | |
| } | |
| const errorType = errorObjs || errors | |
| const errorMessage = errorType.message ? errorType.message : errorType | |
| return ( | |
| <div className="ErrorPage"> | |
| <div className="ErrorPage-Items"> | |
| <h2>No matching tiles found.</h2> | |
| <h2>{errorMessage}</h2> | |
| </div> | |
| </div> | |
| ) | |
| } | |
| export default ErrorPage |