-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Initial commit for react-tic-tac-toe sample #86
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,341 @@ | |||
/******/ (function(modules) { // webpackBootstrap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the bundle?
} | ||
|
||
// make a move | ||
private move(pos: number, val: CellValue, callback?: () => void): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only call this with a callback at one place, so just pass this.aiMove
wrapped in an arrow function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ea3e714
Hey @liminzhu, looks like we're almost there. The sample should not include its dependencies though. That means no |
Thanks for helping the review @DanielRosenwasser! Is there a risk of breaking if the |
@liminzhu nope because so long as you've locked onto the dependencies in your |
@DanielRosenwasser Oh my bad I didn't realize that! Deleted the |
this.handleGameStateChange(this.state.gameState); | ||
} | ||
if (callback) { | ||
callback.call(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what I meant by my previous comment is that you don't need to bind this
to the callback anyhow, so we should get rid of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also restore the old aiMove
method if you feel it's appropriate.
A typescript-react-webpack sample built following the react-webpack guidelines from typescript handbook.