Skip to content

Instantly share code, notes, and snippets.

View vitorbritto's full-sized avatar
🏠
Working from home

Vitor Britto vitorbritto

🏠
Working from home
View GitHub Profile
<ErrorBoundary>
<MyComponent />
</ErrorBoundary>
@vitorbritto
vitorbritto / ErrorBoundary.tsx
Created May 14, 2023 19:02
Source Error Boundary
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError(error) {
// Update state so the next render will show the fallback UI.
return { hasError: true };
@vitorbritto
vitorbritto / index.ts
Last active May 14, 2023 19:00
React Error Boundary - App
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { AppError } from './components/AppError';
ReactDOM.render(
<React.StrictMode>
<AppError>
@vitorbritto
vitorbritto / AppError.tsx
Last active May 14, 2023 18:59
React Error Boundary
import { Component } from 'react';
const ErrorComponent = () => {
return <h1>Something went wrong</h1>;
};
export class AppError extends Component {
state = {
hasError: false,
};
@vitorbritto
vitorbritto / keybase.md
Created April 5, 2022 15:12
Keybase Proof

Keybase proof

I hereby claim:

  • I am vitorbritto on github.
  • I am vitorbritto (https://keybase.io/vitorbritto) on keybase.
  • I have a public key ASAlgVIS18Rhy8It_4saeW-NLIB-VYoiFZeTPYSjz6M9qQo

To claim this, I am signing this object:

@vitorbritto
vitorbritto / postgres-brew.md
Created September 10, 2021 02:36 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@vitorbritto
vitorbritto / vscode-settings.json
Created June 22, 2021 16:56
My VS Code Settings
{
"explorer.confirmDelete": false,
"window.zoomLevel": -2,
"guides.enabled": false,
"explorer.confirmDragAndDrop": false,
"[json]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
@vitorbritto
vitorbritto / node-modules.md
Last active July 29, 2016 11:18
Install all node modules on my workflow

Workflow - Install Node modules

$ npm i -g
grunt-cli gulp-cli
jshint jscs clean-css eslint babel-eslint uncss
babel
nodemon pm2 browser-sync
@vitorbritto
vitorbritto / makefile
Created July 6, 2016 12:47
Using makefile to run automated tasks
# MAKEFILE
#
# Autor: Vitor Britto
# Versão: 0.1.0
#
#
# Descrição:
# Arquivo para gerar um estrutura inicial para
# novos projetos e realizar tarefas de automação
#