Gocha Gochitashvili
Gocha Gochitashvili

Reputation: 305

React-dnd Module not found

I'm new in react.. Following this tutorial I have successfully launch fresh App.

Also installed:

npm install --save react-dnd
npm install --save react-dnd-html5-backend

When I included files from this tutorial

import PropTypes from 'prop-types';
import { DragSource } from 'react-dnd';
import { ItemTypes } from './Constants';

Gives me error:

./src/App.js
Module not found: Can't resolve './Constants' in 'C:\...\...\...\Apps\draggable\src'

What I'm doing wrong?

Upvotes: 0

Views: 8128

Answers (1)

Aniruddh Agarwal
Aniruddh Agarwal

Reputation: 917

There is a problem with your Constants file. You don't have any Constants.js in your current directory. Go through the link again and find the Constants.js creating

For the time, I have found some work around for this:

Try creating a Constants.js in your current directory

Then add a constant to that directory like this:

export const ItemTypes = {
  KNIGHT: 'knight'
};

and save that file. Go through this link for further information. http://react-dnd.github.io/react-dnd/docs-tutorial.html

Upvotes: 3

Related Questions