I am not able to resolve the below issue, hence seeking help here.
I have the below react component which I am navigating to after creating a entity.. Create -> Overview. In the overview I pass the entityId and then Load it via API and render in the overview page.
export default function FlowOverviewComponent() {
let { flowId = "" } = useParams();
const [flow, setFlow] = useState<Flow>({
id: "",
flowName: "",
flowDescription: "",
type: "flow",
});
useEffect(() => {
const loadFlow = async () => {
const response = await axios.get("http://localhost:8081/flow/".concat(flowId));
setFlow(response.data);
}
loadFlow();
}, []);
Binding below:
<TextField
id="outlined-basic"
label="Flow Name"
variant="outlined"
//defaultValue=""
value={flow.flowName}
onChange={(e) =>
setFlow({...flow, flowName: e.target.value})
}
/>
<TextField
id="outlined-basic"
label="Flow Description"
variant="outlined"
//defaultValue=""
value={flow.flowDescription}
onChange={(e) =>
setFlow({...flow, flowDescription: e.target.value})
}
/>
I am expecting that the flow details are displayed in the controls. But seems like the flow state is being reset.
2
Answers
Finally what worked is the below:
trying using