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
export ZSH="/Users/rs0230/.oh-my-zsh" | |
ZSH_THEME='gnzh' | |
plugins=( | |
git | |
dnf | |
zsh-autosuggestions | |
) |
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 React from 'react' | |
class Suspense extends React.Component { | |
state = { | |
promise: null | |
}; | |
componentDidCatch(error) { | |
// Oh my god, this is the desired Promise 😬 | |
if (error instanceof Promise) { |
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 SplitFactory from '@splitsoftware/splitio' | |
// Instancia a SDK | |
const factory = SplitFactory({ | |
core: { | |
authorizationKey: 'YOUR_API_KEY', | |
// A 'key' pode ser o ID do usuário conectado ou o ID da conta à qual o | |
// usuário conectado pertence. Em resumo, o ID é a chave que identificado o | |
// usuário. Dependendo da sua regra de negócio, faz mais sentido usar o | |
// identificado como um grupo invés do ID do usuá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
import SplitFactory from '@splitsoftware/splitio') | |
const factory = SplitFactory({ | |
core: { | |
authorizationKey: 'YOUR_API_KEY' | |
// note que não passamos mais uma key aqui | |
} | |
}); | |
const client = factory.client() |
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 React, { FC } from 'react' | |
import { SWRConfig } from 'swr' | |
import axios from 'axios' | |
import { ProfileContainer } from './ProfileContainer' | |
import './App.css' | |
const fetcher = (url: string) => | |
axios(url).then( | |
response => |
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 ProfileContainer: FC = () => ( | |
<Suspense fallback={<SkeletonLoading />}> | |
<ProfileData /> | |
</Suspense> | |
) |
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 ProfileData: FC = () => { | |
const { data, isValidating, mutate } = useSWR( | |
'https://api.github.com/users/toruticas', | |
) | |
return ( | |
<div className="ProfileData"> | |
... | |
{isValidating && ( |
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 React, { Suspense, ReactNode } from 'react' | |
import { cache } from 'swr' | |
import { GITHUB_PROFILE_API } from './api' | |
import { ProfileData } from './ProfileData' | |
import { SkeletonLoading } from './SkeletonLoading' | |
import { ConfusedIcon } from './ConfusedIcon' | |
import './ErrorBoundary.css' |
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 ProfileData: FC = () => { | |
const { data, error, isValidating, mutate } = useSWR(GITHUB_PROFILE_API) | |
return ( | |
<div className="ProfileData"> | |
... | |
{error && ( | |
<div className="spinner"> | |
<AlertIcon /> | |
</div> |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"baseUrl": "src/", | |
"target": "es5", | |
"lib": [ | |
"dom", | |
"dom.iterable", | |
"esnext" | |
], | |
"allowJs": true, |