This project implements a drag-and-drop interface using React and react-beautiful-dnd
where users can move items between columns and reorder the columns themselves.
Before setting up the project, make sure you have the following installed on your local machine:
Clone the Repository
Clone the project to your local machine using the following command:
git clone https://github.com/imarjunshrma/DragnDropNextApp.git
Navigate to the Project Directory
cd your-repo-name
Install Dependencies
Install all the required dependencies for the project:
npm install
To ensure that the drag-and-drop functionality works correctly, React's strict mode must be disabled. You can disable it by modifying the next.config.js
file in your Next.js project.
Open the next.config.js
file.
Add the following configuration:
const nextConfig = {
reactStrictMode: false,
};
module.exports = nextConfig;
Important: The project will only function correctly if reactStrictMode
is set to false
. React's strict mode is known to cause issues with the drag-and-drop functionality by performing double rendering of components in development mode, which interferes with the way state updates work in react-beautiful-dnd
.
Once you have installed the dependencies and disabled strict mode, you can start the project locally with:
npm run dev
Then open http://localhost:3000 in your browser to view the drag-and-drop application.
onDragEnd
: This function handles both column reordering and item movement within or between columns. The data structure is updated when a drag-and-drop action is completed.components/
: Contains the reusable UI components for the app.utils/
: Includes utility functions (if any).pages/
: Main app entry point.next.config.js
: Next.js configuration file where strict mode is disabled.