import { useStatus } from 'client/hooks/Calculation/useStatus';
import { useComputedValue } from 'client/hooks/Calculation/useValue';
import { observer } from 'mobx-react-lite';

export default ({ name, valueName: computedValueName, Component, ...props }) =>
  observer(() => {
    const { value } = useComputedValue({
      computedValueName,
    });
    const { status } = useStatus(name);
    return <Component value={value} status={status} {...props} />;
  });
