- 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:
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 |
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> |