DEV Community

Sunil Dora
Sunil Dora

Posted on

How copy and move the component in React?

I'm a newbie to react and redux, I'm having one issue and tried to find about it but still, I'm unable to find the solution for it.

Currently, I'm developing a system for drag and drop feature to generate a page using forms, text, button, etc components. Please note I'm not using any npm library for the drag n drop. Currently, I have done the portion of drag and drop using javascript drag events, but the issue is currently I'm dragging and dropping the HTML content not a component. I don't want to use any external plugin for this.

My need: my need is I want to drag n drop the component so I can apply all the React features on it. Please check the attached image for more details.

Sorry all, if I'm asking any silly question to you guys.

Hope anyone can help me with this.

Thanks in advance.

Top comments (2)

Collapse
 
dance2die profile image
Sung M. Kim

It looks like you want to have a central location to have states be passed around between components.

It means you can research, which Application Statement Management you want to choose.

The link shows how to do so with React Context API, but as the site gets better, you might want to check out Redux or MobX.

Collapse
 
sunildora94 profile image
Sunil Dora

Can you please create an example or can give any link that already shows how to copy a component from one component to another component? It would be great if you can do it for me.

Thanks for giving the answer.