willb335 / chessboardjsx

:black_square_button: Chessboard built for React
https://chessboardjsx.com
MIT License
267 stars 79 forks source link

Legacy context API warnings in React 16.3+ #54

Open maxwellhaydn opened 4 years ago

maxwellhaydn commented 4 years ago

chessboardjsx is pinned to an old version (2.6.0) of react-dnd that uses React's legacy context API. This generates warnings in React 16.3+:

index.js:1 Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.

Please update the following components: DragDropContext(t), DragLayer(t)

Learn more about this warning here: https://fb.me/react-legacy-context
    in DragDropContext(t) (at src/index.js:7)
    in StrictMode (at src/index.js:6)
console.<computed> @ index.js:1
printWarning @ react-dom.development.js:88
error @ react-dom.development.js:60
(anonymous) @ react-dom.development.js:11432
push../node_modules/react-dom/cjs/react-dom.development.js.ReactStrictModeWarnings.flushLegacyContextWarning @ react-dom.development.js:11418
flushRenderPhaseStrictModeWarningsInDEV @ react-dom.development.js:23109
commitRootImpl @ react-dom.development.js:22396
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
commitRoot @ react-dom.development.js:22381
finishSyncRender @ react-dom.development.js:21807
performSyncWorkOnRoot @ react-dom.development.js:21793
scheduleUpdateOnFiber @ react-dom.development.js:21188
updateContainer @ react-dom.development.js:24373
(anonymous) @ react-dom.development.js:24758
unbatchedUpdates @ react-dom.development.js:21903
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
./src/index.js @ index.js:5
__webpack_require__ @ bootstrap:784
fn @ bootstrap:150
1 @ index.js:7
__webpack_require__ @ bootstrap:784
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
index.js:1 Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.

Please update the following components: DropTarget(t)

Learn more about this warning here: https://fb.me/react-legacy-context
    in DropTarget(t) (created by t)
    in div (created by t)
    in div (created by t)
    in t (created by Context.Consumer)
    in t (created by t)
    in div (created by t)
    in t (created by t)
    in t (created by DragDropContext(t))
    in DragDropContext(t) (at src/index.js:7)
    in StrictMode (at src/index.js:6)

Code that triggered the warnings:

import React from 'react';
import ReactDOM from 'react-dom';
import Chessboard from 'chessboardjsx';

ReactDOM.render(
  <React.StrictMode>
    <Chessboard />
  </React.StrictMode>,
  document.getElementById('root')
);

chessboardjsx version 2.4.2