2022-05-16 19:44:42 +03:00

15 lines
469 B
TypeScript

import { observer } from 'mobx-react-lite';
import { useValue } from 'stores/calculation/values/hooks';
import { getValueName } from '../config/map';
import type { BuilderProps } from './types';
export default function buildValueElement({ elementName, Component, ...props }: BuilderProps) {
const valueName = getValueName(elementName);
return observer(() => {
const { value } = useValue(valueName);
return <Component value={value} {...props} />;
});
}