Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

page.tsx 647B

123456789101112131415161718192021222324
  1. import { useSelector } from "state"
  2. import { deepCompareArrays } from "utils/utils"
  3. import Shape from "./shape"
  4. /*
  5. On each state change, compare node ids of all shapes
  6. on the current page. Kind of expensive but only happens
  7. here; and still cheaper than any other pattern I've found.
  8. */
  9. export default function Page() {
  10. const currentPageShapeIds = useSelector((state) => {
  11. const { currentPageId, document } = state.data
  12. return Object.keys(document.pages[currentPageId].shapes)
  13. }, deepCompareArrays)
  14. return (
  15. <>
  16. {currentPageShapeIds.map((shapeId) => (
  17. <Shape key={shapeId} id={shapeId} />
  18. ))}
  19. </>
  20. )
  21. }