Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Drag and drop reactJs using beautiful dnd

I am trying to practice #Drag and Drop FreeCodeCamp So I created a state which includes a number of boxes and inside these boxes, there should be an icon that I suppose to be able to move to any of the generated boxes so the problem with my code is that when picking the icon it renders all the boxes instead of one box

const [pointPlace, setPointPlace] = useState([...Array(162).keys()]);
 
const handleOnDragEnd = result => {
    const items = Array.from(pointPlace);
    const [reorderboxes] = items.splice(result.source.index, 1);
    items.splice(result.destination.index, 0, reorderboxes);
    setPointPlace(items);
};



return (
    <Box>
        <DragDropContext onDragEnd={handleOnDragEnd}>
            <Droppable droppableId="pointsContainer">
                {provided => (
                    <Box
                        className={classes.container}
                        display={'flex'}
                        flexGrow={1}
                        flexWrap={'wrap'}
                        alignItems={'center'}
                        justifyContent={'center'}
                        ref={provided.innerRef}
                        {...provided.droppableProps}
                    >
                        {pointPlace.map((index, id) => (
                            <Draggable draggableId="draggable-point" index={index} key={id}>
                                {provided => (
                                    <Box className={classes.box} ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps}>
                                        {point} <p className={classes.boxNumber}>{index}</p>
                                    </Box>
                                )}
                            </Draggable>
                        ))}
                    </Box>
                )}
            </Droppable>
        </DragDropContext>
    </Box>
);
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!