import React, { useRef } from "react";
/**
 * Like class component constructor, the callback will be called only once.
 * @param {*} callBack 
 * @returns 
 */

export default function useConstructor(callBack) {
  const initialRender = useRef(!callBack);

  if (initialRender.current) {
    return;
  }

  ;
  callBack && callBack();
  initialRender.current = true;
}