I try to manage the prop of "supportedSubmitMethods" with state but its seems it not listen to the state changes to re render and it stay at the initial state.( Tested with useEffect and with OnClick event)
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
const SwaggerApi: FC<{}> = ({}) => {
const [supportedSubmitMethods, setSupportedSubmitMethods] = useState<undefined | string[]>([]);
useEffect(() => {
setSupportedSubmitMethods(undefined);
}, []);
const handleAnotherStateChange = ()=>{
setSupportedSubmitMethods(p=> p === undefined ? [] :undefined)
}
return (
<div onClick={handleAnotherStateChange}>
<SwaggerUI
supportedSubmitMethods={supportedSubmitMethods}
url={"https://localhost:7035/swagger/v1/swagger.json"}
/>
</div>
);
};
export default SwaggerApi;