The one with decorators
This commit is contained in:
parent
2be15b57e8
commit
74b4a383b4
17
Next/.babelrc
Normal file
17
Next/.babelrc
Normal 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
1842
Next/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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"
|
||||
|
@ -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
1925
Next/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
5
package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
}
|
10
pnpm-lock.yaml
Normal file
10
pnpm-lock.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user