Skip to content

Instantly share code, notes, and snippets.

Checklist do react-redux

Antes de começar

  • pensar como será o formato do seu estado global
  • pensar quais actions serão necessárias na sua aplicação

Instalação

  • npx create-react-app my-app-redux;
  • npm install --save redux react-redux;
// 1.Adicione a tag h1 com o texto Exercício 5.2 - JavaScript DOM como filho da tag body ;
let h1 = document.createElement('h1');
document.body.appendChild(h1);
h1.innerHTML = "Exercício 5.2 - JavaScript DOM";
// 2.Adicione a tag div com a classe main-content como filho da tag body ;
let mainContent = document.createElement('div');
mainContent.classList.add('main-content');
document.body.appendChild(mainContent)
function rgb(r, g, b){
// EARLY RETURN (VALIDAR ANTES)
// se for negativo, fica 00 (0)
// se passar de 255, fica FF (255)
let array = [r, g , b];
for(let color in array){
if(array[color] < 0){
array[color] = "00";
} else if (array[color] > 255){
// Primeiro Sistema
// 1: 10, 2: 8, 3: 6, 4: 5, 5: 4, 6:3, 7: 2, 8: 1
let firstSystem = [10, 8, 6, 5, 4, 3, 2, 1];
// Segundo Sistema
// 1: 25, 2: 18, 3: 15, 4: 12, 5: 10, 6: 8, 7: 6, 8: 4, 9: 2, 10: 1
let secondSystem = [25, 18, 15, 12, 10, 8, 6, 4, 2 , 1];
// Resultado da Corrida
// 1: Rubinho, 2: Schumacher, 3: Alonso, 4: Hamilton
{
"_id": "LKKmV9iliS0hgpe4",
"name": "Shuruh",
"type": "character",
"data": {
"attributes": {
"raca": "Trog (F)",
"pv": {
"value": 8,
"min": -500,