Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tutorial code snippets #1223

Merged
merged 7 commits into from Mar 6, 2019
Merged

Fix tutorial code snippets #1223

merged 7 commits into from Mar 6, 2019

Conversation

mckomo
Copy link
Contributor

@mckomo mckomo commented Feb 11, 2019

I was going through the tutorial and noticed a few bugs in the code snippets. This PR aims to fix them.

Changes are:

  • Board should not reference helper functions via this since it is an SFC.
  • Declare and use handleSquareClick, renderPiece and renderOverlay as a static function to be consistent with the previous example where renderSquare was introduced as a static function.
  • Use DragDropContext HOC instead of DragDropContextProvider to avoid Cannot have two HTML5 backends at the same time. error.

@darthtrevino
Copy link
Member

LGTM, I think we'll want to eventually make this more idiomatic (e.g. renderSquare is really a Function component, handleSquareClick should be a callback hook).

@darthtrevino darthtrevino merged commit 3899877 into react-dnd:master Mar 6, 2019
@mckomo mckomo deleted the patch-1 branch March 25, 2019 08:35
darthtrevino pushed a commit that referenced this pull request Feb 3, 2022
* Fix tutorial code snippets

* Fix onClick handler example

* Use handleSquareClick as a regular function

* Fix renderPiece function in tutorial

* Fix DragDropContext usage

Fixes: `Cannot have two HTML5 backends at the same time.`

* Fix renderOverlay usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants