Skip to content

Instantly share code, notes, and snippets.

@tfiechowski
Created October 30, 2019 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfiechowski/77dd27434528d178ade11bb3e6456d49 to your computer and use it in GitHub Desktop.
Save tfiechowski/77dd27434528d178ade11bb3e6456d49 to your computer and use it in GitHub Desktop.
import React, { useContext } from "react";
import DragItem from "./DragItem";
import { Grid, GridImage, GridItem } from "./Grid";
import GridContext from "./GridContext";
function App() {
const { items, moveItem } = useContext(GridContext);
return (
<div className="App">
<Grid>
{items.map(item => (
<DragItem key={item.id} id={item.id} onMoveItem={moveItem}>
<GridItem>
<GridImage src={item.src}></GridImage>
</GridItem>
</DragItem>
))}
</Grid>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment