選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

page.tsx 587B

123456789101112131415161718192021222324
  1. import { useSelector } from "state"
  2. import { deepCompareArrays, getPage } 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(
  11. ({ data }) => Object.keys(getPage(data).shapes),
  12. deepCompareArrays
  13. )
  14. return (
  15. <>
  16. {currentPageShapeIds.map((shapeId) => (
  17. <Shape key={shapeId} id={shapeId} />
  18. ))}
  19. </>
  20. )
  21. }