0

I have react 18 and cant get this code to work. [1]: https://codesandbox.io/s/react-grid-gallery-forked-v3jv6z?file=/src/index.js Copied everything from the source. Just without this part:

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

cos I am exporting it and then importing to the main one. No error messages, but gallery just wont show. The only difference is that i imported like this:

import {Gallery} from "react-grid-gallery";

not like import Gallery from "react-grid-gallery";

cos otherwise i was getting errors Can u pls try end and tell me if it works for ya? Am i missing something?

Simon Buryat
  • 15
  • 1
  • 7
  • Yeah the import depends on how its exported. https://stackoverflow.com/questions/31096597/using-brackets-with-javascript-import-syntax You should look into using eslint and typescript, then the system will tell you and fix these types of issues. – Disco Nov 08 '22 at 09:50
  • how can this help me? i cant import without curly brackets anyway – Simon Buryat Nov 08 '22 at 10:49
  • Since you do not share the code where you use `Gallery ` I assumed that your issue where with the imports. Looking into the CodeSandbox that you link they use the 0.5.3 version and you probably use 1.0.0 of React Grid Gallery. Try use the official example at https://github.com/benhowell/react-grid-gallery If you still have issues, share your code. – Disco Nov 08 '22 at 12:29
  • i managed to find a working code. this one https://codesandbox.io/s/github/benhowell/react-grid-gallery/tree/master/examples/with-react-image-lightbox?fontsize=14&hidenavigation=1&theme=dark – Simon Buryat Nov 08 '22 at 14:01

0 Answers0