Skip to content

Commit

Permalink
feat: add useState for select values
Browse files Browse the repository at this point in the history
  • Loading branch information
mariaozamiz committed Mar 7, 2024
1 parent 94f16ee commit 7f51445
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ interface PageProps {

export const GeneralPractitionersStep: React.FC<PageProps> = React.memo(props => {
const { name = "Personnel analysis: General Practitioners missing and double counts" } = props;
const { doubleCountsList, values, handleChange, runAnalysis, valueChange, catCombosList } =
useGeneralPractitionersStep();
const {
doubleCountsList,
value,
values,
handleChange,
runAnalysis,
valueChange,
catCombosList,
} = useGeneralPractitionersStep();

return (
<Container>
Expand All @@ -32,7 +39,7 @@ export const GeneralPractitionersStep: React.FC<PageProps> = React.memo(props =>
key={"double-counts-filter"}
items={doubleCountsList}
onChange={valueChange}
value={"somevalue"}
value={value}
label={i18n.t("Double Counts Threshold")}
/>
<Button variant="contained" color="primary" size="small" onClick={runAnalysis}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,19 @@ export function useGeneralPractitionersStep() {
},
];

const valueChange = (e: any) => {
alert(`Valor cambiado: ${e.target.value}`);
const valueChange = (value: string | undefined) => {
setValue(value || "");
};

const [value, setValue] = useState<string>("");

return {
doubleCountsList,
values,
handleChange,
runAnalysis,
valueChange,
catCombosList,
value,
};
}

0 comments on commit 7f51445

Please sign in to comment.