@croquet/react
Version:
React bindings for Croquet
11 lines (10 loc) • 332 B
JavaScript
import { useView } from './useView';
/** Hook that sets up a callback for Croquet.View.detach().
* The function will be called when the root View is detached.
*/
export function useDetachCallback(callback) {
const croquetView = useView();
if (croquetView !== null) {
croquetView.detachCallback = callback;
}
}