Download spectrum/src/helpers/signed-out-fallback.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 885 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/helpers/signed-out-fallback.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/helpers/signed-out-fallback.js
-
curl -L -o signed-out-fallback.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/helpers/signed-out-fallback.js
885 Bytes
| // @flow | |
| import React from 'react'; | |
| import compose from 'recompose/compose'; | |
| import { withCurrentUser } from 'src/components/withCurrentUser'; | |
| import AuthViewHandler from 'src/views/authViewHandler'; | |
| const Switch = props => { | |
| const { Component, FallbackComponent, ...rest } = props; | |
| return ( | |
| <AuthViewHandler> | |
| {authed => { | |
| if (!authed) return <FallbackComponent {...rest} />; | |
| return <Component {...rest} />; | |
| }} | |
| </AuthViewHandler> | |
| ); | |
| }; | |
| // Connect that component to the Redux state | |
| const ConnectedSwitch = compose(withCurrentUser)(Switch); | |
| const signedOutFallback = ( | |
| Component: React$ComponentType<*>, | |
| FallbackComponent: React$ComponentType<*> | |
| ) => { | |
| return (props: *) => ( | |
| <ConnectedSwitch | |
| {...props} | |
| FallbackComponent={FallbackComponent} | |
| Component={Component} | |
| /> | |
| ); | |
| }; | |
| export default signedOutFallback; | |