pmndrs/react-three-fiber

RFC: @react-three/eslint-plugin rules

Open

#2701 aperta il 10 gen 2023

Vedi su GitHub
 (15 commenti) (10 reazioni) (0 assegnatari)TypeScript (1464 fork)batch import
help wantedrequest for commentsv10

Metriche repository

Star
 (25.748 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Aligning with our docs for general performance pitfalls and API usage around context (use R3F hooks within Canvas):

  • no-clone-in-frame-loop: Prefer creating temporary objects in global space and copy rather than clone in hot paths. This should be restricted to three.js classes to avoid collisions. https://github.com/pmndrs/react-three-fiber/pull/2710
  • no-fast-state: Don't set state within loops or continuous events (startTransition can be used if you must, this can be disabled for specific polling cases)
  • prefer-useloader: Prefer useLoader for suspense and caching rather than calling Loader.load or Loader.loadAsync in an effect. This will de-dup resources on both the CPU and GPU and avoid later expensive runtime compilation.

Guida contributor