Skip to content

Commit

Permalink
Merge branch 'main' of github.com:joey998/blog
Browse files Browse the repository at this point in the history
  • Loading branch information
joey998 committed Jun 1, 2024
2 parents 6db7b51 + 1ad63a0 commit f6c5327
Show file tree
Hide file tree
Showing 3 changed files with 2,174 additions and 807 deletions.
41 changes: 41 additions & 0 deletions output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function testLog(a,b,cs){console.log(a, b, c);}

function alert(a) {
alert(a);
}


// 以下每一种都能被匹配到
const a1 = 123;
const a2 = "b";
const a3 = () => 1;

const dict = {
a: 1,
b: 2,
c: 'f',
};

class Toggle extends React.Component {
constructor(props) {
super(props);
this.state = { isToggleOn: true };

// This binding is necessary to make `this` work in the callback
this.handleClick = this.handleClick.bind(this);
}

handleClick() {
this.setState((prevState) => ({
isToggleOn: !prevState.isToggleOn,
}));
}

render() {
return (
<button onClick={this.handleClick}>
{this.state.isToggleOn ? 'ON' : 'OFF'}
</button>
);
}
}
23 changes: 23 additions & 0 deletions output2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Toggle extends React.Component {
constructor(props) {
super(props);
this.state = { isToggleOn: true };
// This binding is necessary to make `this` work in the callback
this.handleClick = this.handleClick.bind(this);;
this.handleClick = this.handleClick.bind(this)
}

handleClick() {
this.setState((prevState) => ({
isToggleOn: !prevState.isToggleOn,
}));
}

render() {
return (
<button onClick={this.handleClick}>
{this.state.isToggleOn ? 'ON' : 'OFF'}
</button>
);
}
}
Loading

0 comments on commit f6c5327

Please sign in to comment.