I am trying to use https://www.npmjs.com/package/chessboardjs package. I wrote simple react component to render the board, but it throws an error in the chessboardjs module: ReferenceError: $ is not defined. The component code:
import React, { Component } from 'react';
import Chess from 'chessboardjs';
export default class ChessBoard extends Component {
render() {
return (
<div>
<div id="chessboard" style={{"width": "400px"}}></div>
</div>
)
}
componentDidMount() {
var board = Chess('chessboard');
}
}
I already tried installing the JQuery npm package and import that in the ChessBoard component but it didn't work unfortunately.
Is there a way to fix this?