- Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
- Opcional: Si usamos Fetch API en el proyecto:
| export const heroes = [ | |
| { | |
| 'id': 'dc-batman', | |
| 'superhero':'Batman', | |
| 'publisher':'DC Comics', | |
| 'alter_ego':'Bruce Wayne', | |
| 'first_appearance':'Detective Comics #27', | |
| 'characters':'Bruce Wayne' | |
| }, | |
| { |
| const heroes = [ | |
| { | |
| id: 1, | |
| name: 'Batman', | |
| owner: 'DC' | |
| }, | |
| { | |
| id: 2, | |
| name: 'Spiderman', | |
| owner: 'Marvel' |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <!-- Cargat React --> | |
| <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> | |
| <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> | |
| <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> |
| <section class="todoapp"> | |
| <header class="header"> | |
| <h1>Tareas</h1> | |
| <input id="new-todo-input" class="new-todo" placeholder="驴Qu茅 necesita ser hecho?" autofocus> | |
| </header> | |
| <!-- This section should be hidden by default and shown when there are todos --> | |
| <section class="main"> | |
| <input id="toggle-all" class="toggle-all" type="checkbox"> | |
| <label for="toggle-all">Mark all as complete</label> |
| import { createSlice } from '@reduxjs/toolkit'; | |
| export const templateSlice = createSlice({ | |
| name: 'name', | |
| initialState: { | |
| counter: 10 | |
| }, | |
| reducers: { | |
| increment: (state, /* action */ ) => { | |
| //! https://react-redux.js.org/tutorials/quick-start |