In my REACT app I'm using npm package react-data-grid. On their website they provide an example of Column Reordering. I want to do exactly the same in my code.
I checked their source code but what I don't understand is how can I import all of the components they are using for columns reordering. Do I need to reimplement in my code all of the components they are using? Isn't a way to simply import them in my react app?
For example, for columns reordering, they are using the DraggableHeaderRenderer component. Is there a way to import this in my app instead of having all of its source code reproduced in my app?
to use
react-data-gridin your app, you need to importDraggableHeaderRenderer. I'll provide you a step-by-step.Install the react-data-grid package:
npm install react-data-gridImport everything you need:
import React from 'react'; import ReactDataGrid from 'react-data-grid'; import { DraggableHeader } from 'react-data-grid-addons';
Define the data and columns for the grid.
Create the main component that renders the data grid.
Here is full code:
Hope this helps.