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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
const StyledGenericComponent = styled.div``; | |
type GenericProps<T> = { | |
as?: React.FC<T> | |
//...otherProps | |
} | |
const GenericComponent = <T>({ as, ...props }: Props<T> & T) => { | |
// some logic | |
return <StyledGenericComponent as={as} {...props}/> |
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 { useLocation } from 'react-router-dom'; | |
import { graphql, usePreloadedQuery, useEnvironment } from 'react-relay/hooks'; | |
const Comp1 = React.lazy(() => import('./Comp1')); | |
const Comp2 = React.lazy(() => import('./Comp2')); | |
const Comp3 = React.lazy(() => import('./Comp3')); | |
const Query = graphql` | |
query RootQuery( |
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
// ---- routes.ts --- | |
import * as React from 'react'; | |
import { prepareQuery } from '../../relay'; | |
export default [ | |
{ | |
path: path => `${path}Home`, | |
component: React.lazy(() => import('./Home')), | |
prepare: () => { |
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 { ROOT_ID } from 'relay-runtime'; | |
import { useRelayEnvironment } from 'react-relay/hooks'; | |
import { useLocation, useHistory } from 'react-router-dom'; | |
import { commitLocalUpdate } from 'react-relay' | |
import { useMutation } from 'relay-hooks/lib'; | |
import { AuthUserMutation } from 'mutations/AuthUserMutation'; | |
export const TOKEN_KEY = 'KEY'; |
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
const theme = { | |
name: 'Credihome' //Nome da empresa | |
primaryColor: '#ffff' // cor primária | |
secondaryColor: '#ffff' // cor secundária | |
logo: 'https://...' // link pro image do logo | |
logoCompact: 'https://...' // link pro image do compacto | |
} |
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
const name = 'Gabriel Santos Souza'; | |
const firstName = name.split(' ')[0]; | |
const secondName = name.split(' ')[1]; | |
console.log(firstName.length + secondName.length); |
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
const { user } = tweet; | |
const { password, ...userWithoutPassword } = user; | |
const newTweet = { ...tweet, user: userWithoutPassword }; |
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
const Login = withFormik<{}, FormValues>({ | |
mapPropsToValues: () => ({ | |
password: '', | |
email: '', | |
remember: true | |
}), | |
validationSchema: Yup.object().shape({ | |
email: Yup.string().required('Usuário é obrigatório'), | |
password: Yup.string().required('Senha é obrigatório'), | |
}), |
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
const Container = styled.div` | |
.classe-1 {} | |
.classe-2 {} | |
`; | |
export default function App() { | |
return ( | |
<Container> | |
<div className="classe-1"/> | |
<div className="classe-2"/> | |
</Container> |
NewerOlder