Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 06 Ajax field change

## Resume
## Summary

This example takes as a starting point the example \ \_05-component-update-render.

Expand All @@ -16,7 +16,7 @@ As a bonus, we will check how to use Debounce (wait a little until the user stop
npm install
```

- Let's open the _demo.js_, and let's add an entry in the state that stores the current search filter, and another state in which we
- Let's open the _demo.tsx_, and let's add an entry in the state that stores the current search filter, and another state in which we
are going to store a list of users.

_./src/demo.tsx_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ así llamadas innecesarias).
npm install
```

- Vamos abrir el fichero _demo.js_ y vamos añadir una entrada en el
- Vamos abrir el fichero _demo.tsx_ y vamos añadir una entrada en el
estado que almacene el filtro actual de busqueda, y otra en la que almacene
una lista de usuarios.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>My App Example</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React App - React hooks</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
{
"name": "react-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"name": "hello-vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "run-p -l type-check:watch start:dev",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"start:dev": "webpack-dev-server --mode development --open",
"build": "rimraf dist && webpack --mode development"
"start": "vite --host",
"build": "vite build",
"preview": "vite preview"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.17.10",
"@babel/preset-env": "^7.17.10",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.16.7",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"babel-loader": "^8.2.5",
"css-loader": "^6.7.1",
"html-loader": "^3.1.0",
"html-webpack-plugin": "^5.5.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"style-loader": "^3.3.1",
"typescript": "^4.6.4",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0"
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"typescript": "^5.8.3",
"vite": "^7.0.4",
"vite-plugin-checker": "^0.10.0"
},
"dependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0",
"use-debounce": "^8.0.1"
"react": "^19.1.0",
"react-dom": "^19.1.0",
"use-debounce": "^10.0.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"compilerOptions": {
"target": "es6",
"module": "es6",
"moduleResolution": "node",
"declaration": false,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"jsx": "react",
"noLib": false,
"suppressImplicitAnyIndexErrors": true,
"noImplicitReturns": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"esModuleInterop": true
"sourceMap": true,
"target": "ESNext",
"useDefineForClassFields": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
"include": ["src"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from "vite";
import checker from "vite-plugin-checker";
import react from "@vitejs/plugin-react";

export default defineConfig({
plugins: [checker({ typescript: true }), react()],
});

This file was deleted.

7 changes: 0 additions & 7 deletions 04-frameworks/01-react/03-react-hooks/07-custom-hook/.babelrc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 07 Custom hooks

## Resume
## Summary

This example takes as its starting point the \ _06-ajax-field-change example.
This example takes as its starting point the _06-ajax-field-change_ example.

Hooks are cool, but our functional component seems to get cluttered, is
there a way to extract functionality outside the functional component?
Expand Down Expand Up @@ -53,7 +53,7 @@ export const MyComponent = () => {

A. Encapsulating as well the _UseEffect_

_./src/demo.js_
_./src/demo.tsx_

```diff
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>My App Example</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React App - React hooks</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
48 changes: 16 additions & 32 deletions 04-frameworks/01-react/03-react-hooks/07-custom-hook/package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
{
"name": "react-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"name": "hello-vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "run-p -l type-check:watch start:dev",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"start:dev": "webpack-dev-server --mode development --open",
"build": "rimraf dist && webpack --mode development"
"start": "vite --host",
"build": "vite build",
"preview": "vite preview"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.17.10",
"@babel/preset-env": "^7.17.10",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.16.7",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"babel-loader": "^8.2.5",
"css-loader": "^6.7.1",
"html-loader": "^3.1.0",
"html-webpack-plugin": "^5.5.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"style-loader": "^3.3.1",
"typescript": "^4.6.4",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0"
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"typescript": "^5.8.3",
"vite": "^7.0.4",
"vite-plugin-checker": "^0.10.0"
},
"dependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0",
"use-debounce": "^8.0.1"
"react": "^19.1.0",
"react-dom": "^19.1.0",
"use-debounce": "^10.0.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { MyComponent } from "./demo";

export const App = () => {
return <MyComponent />;
};
};
25 changes: 13 additions & 12 deletions 04-frameworks/01-react/03-react-hooks/07-custom-hook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"compilerOptions": {
"target": "es6",
"module": "es6",
"moduleResolution": "node",
"declaration": false,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"jsx": "react",
"noLib": false,
"suppressImplicitAnyIndexErrors": true,
"noImplicitReturns": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"esModuleInterop": true
"sourceMap": true,
"target": "ESNext",
"useDefineForClassFields": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
"include": ["src"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from "vite";
import checker from "vite-plugin-checker";
import react from "@vitejs/plugin-react";

export default defineConfig({
plugins: [checker({ typescript: true }), react()],
});
Loading