const form = useFormState({
email: '',
password: ''
})
// returns form.setEmail, form.email, form.setPassword, and form.password
<input value={form.email} onChange={form.setEmail} />
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if an element is under an anchor element | |
*/ | |
function isDescendantOfAnchor(element) { | |
do { | |
if (element.tagName === 'A') { | |
return true | |
} | |
} while(element = element.parentNode) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h5 class="text-fade-in js-animatable" data-animatable-offset="256" data-animatable-delay="200">Staging</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="324" data-animatable-delay="300">Deep-cleaning</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="324" data-animatable-delay="400">Cosmetic renovations</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="358" data-animatable-delay="500">Decluttering</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="392" data-animatable-delay="600">Landscaping</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="460" data-animatable-delay="700">Painting</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="460" data-animatable-delay="800">Pest control</h5> | |
<h5 class="text-fade-in js-animatable" data-animatable-offset="494" data-animatable-delay="900">Custom closets</h5> | |
<div class="photo-cover js-animatable"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Location, LocationState } from 'history'; | |
import { RouteComponentProps as ReactRouteComponentProps } from 'react-router-dom' | |
export interface RouteComponentProps<Q = { [key: string]: string }> extends ReactRouteComponentProps { | |
location: Location<LocationState> & { | |
query: Q | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Error404Context.js | |
export default {Provider, Consumer} = React.createContext() | |
// Error404Provider.js | |
class Error404Provider extends React.Component { | |
state = { | |
isError: false | |
} | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import instance from './instance' | |
import { toast } from '@app/components/Toast' | |
import { AxiosRequestConfig, AxiosError } from 'axios'; | |
interface IAxiosInterceptorValidationConfig extends AxiosRequestConfig { | |
appValidationError?: string | boolean | |
} | |
interface IAxiosInterceptorValidationError extends AxiosError { | |
config: IAxiosInterceptorValidationConfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function subsetIncludes(array: any[], value: any): boolean { | |
return Boolean( | |
array.find(arrayValue => isSubset(arrayValue, value)) | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import { Route } from 'react-router-dom' | |
import { RouteProps } from 'react-router' | |
interface IRouterRouteProps extends RouteProps { | |
component: any | |
} | |
class RouterRoute extends React.Component<IRouterRouteProps> { | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import { Switch } from 'react-router-dom' | |
interface IRouterSwitch { | |
children: any | |
} | |
class RouterSwitch extends React.Component<IRouterSwitch, {}> { | |
render() { | |
const {children, ...rest} = this.props |