Created
October 30, 2019 08:24
-
-
Save tfiechowski/77dd27434528d178ade11bb3e6456d49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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