UNPKG

react-native-filament

Version:

A real-time physically based 3D rendering engine for React Native

20 lines (19 loc) 514 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useEntityInScene = useEntityInScene; var _react = require("react"); /** * A hook that "on mount" adds the entity to the scene, and "on unmount" removes it. */ function useEntityInScene(scene, entity) { (0, _react.useEffect)(() => { if (entity == null) return; scene.addEntity(entity); return () => { scene.removeEntity(entity); }; }, [entity, scene]); } //# sourceMappingURL=useEntityInScene.js.map