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
4 changes: 4 additions & 0 deletions demos/hello_world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { doIt } from './utils.js';

console.log("Hello, World!");
doIt();
13 changes: 13 additions & 0 deletions demos/hello_world/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "hello_world",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
5 changes: 5 additions & 0 deletions demos/hello_world/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


export function doIt(){
console.log('doIt');
}
27 changes: 27 additions & 0 deletions demos/js_demos/filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

const nums = [1,5,2,9,6,3,8,2];

const doubleNums = nums.map(num => num * 2);

// function expression
// const greaterThan4 = function (num) { return num > 4; };

// function declaration
function greaterThan4(num) {
return num > 4;
};

function myfilter(arr, predicateFn) {

const newArr = [];

arr.forEach(element => {
if (predicateFn(element))
{
newArr.push(element);
}
});
}
console.log(nums);
console.log(doubleNums);
console.log(myfilter(nums, greaterThan4));
6 changes: 6 additions & 0 deletions demos/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions demos/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "tools-app-react",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"vite": "^5.2.0"
},
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
21 changes: 21 additions & 0 deletions demos/tools-app-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions demos/tools-app-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions demos/tools-app-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
42 changes: 42 additions & 0 deletions demos/tools-app-react/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"colors": [
{
"id": "1",
"name": "red",
"hexcode": "#ff0000"
},
{
"id": "2",
"name": "green",
"hexcode": "#00ff00"
},
{
"id": "3",
"name": "blue",
"hexcode": "#0000ff"
},
{
"id": "ab3f",
"name": "blue",
"hexcode": "00f"
}
],
"cars": [
{
"id": "1",
"make": "Ford",
"model": "Fusion Hybrid",
"year": 2019,
"color": "blue",
"price": 45000
},
{
"id": "2",
"make": "Tesla",
"model": "S",
"year": 2018,
"color": "red",
"price": 100000
}
]
}
13 changes: 13 additions & 0 deletions demos/tools-app-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading