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": "",
"license": "ISC",
"dependencies": {
"mobx": "^6.1.8",
"mobx-react": "^7.1.0",
"next": "^10.0.9",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"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/react": "^17.0.3",
"typescript": "^4.2.3"

View File

@ -1,6 +1,24 @@
function Index() {
return (
<p>Hello World</p>
);
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 (
<button onClick={this.clickMe.bind(this)}>{this.x}</button>
);
}
}
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,
"isolatedModules": true,
"jsx": "preserve",
"esModuleInterop": true
"esModuleInterop": true,
"experimentalDecorators": true
},
"include": [
"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