The one with decorators

This commit is contained in:
Damillora 2021-03-25 14:05:25 +07:00
parent 2be15b57e8
commit 74b4a383b4
8 changed files with 1986 additions and 1847 deletions

17
Next/.babelrc Normal file
View File

@ -0,0 +1,17 @@
{
"presets": ["next/babel"],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": false
}
]
]
}

1842
Next/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,11 +12,16 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"mobx": "^6.1.8",
"mobx-react": "^7.1.0",
"next": "^10.0.9", "next": "^10.0.9",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2" "react-dom": "^17.0.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-decorators": "^7.13.5",
"@types/node": "^14.14.35", "@types/node": "^14.14.35",
"@types/react": "^17.0.3", "@types/react": "^17.0.3",
"typescript": "^4.2.3" "typescript": "^4.2.3"

View File

@ -1,6 +1,24 @@
function Index() { import { makeObservable, observable, action } from 'mobx';
import { observer } from 'mobx-react';
import React from 'react';
@observer class Index extends React.Component {
@observable x: number = 0;
constructor(props) {
super(props);
}
@action
clickMe() {
this.x += 1;
}
render() {
return ( return (
<p>Hello World</p> <button onClick={this.clickMe.bind(this)}>{this.x}</button>
); );
} }
}
export default Index; export default Index;

1925
Next/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,8 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"esModuleInterop": true "esModuleInterop": true,
"experimentalDecorators": true
}, },
"include": [ "include": [
"next-env.d.ts", "next-env.d.ts",

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"devDependencies": {
"tslib": "^2.1.0"
}
}

10
pnpm-lock.yaml Normal file
View File

@ -0,0 +1,10 @@
devDependencies:
tslib: 2.1.0
lockfileVersion: 5.2
packages:
/tslib/2.1.0:
dev: true
resolution:
integrity: sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
specifiers:
tslib: ^2.1.0