Let's say I have one component that only holds an image and two divs, one holding the componenet, laid out as such:
Upon being clicked, the component will move into the other div
Then when the component is clicked again, it moves back to its original spot, like such:
What would the logic be in order to accomplish this? Any help would be appreciated especially with code examples.
CodePudding user response:
You can refer to my codesandbox link: https://codesandbox.io/embed/magical-minsky-bx681m?fontsize=14&hidenavigation=1&theme=dark