Open jernej-lipovec-viaduct opened 2 years ago
@jernej-lipovec-viaduct did you find any workarounds for this?
@jernej-lipovec-viaduct did you find any workarounds for this?
We are now using Web Component version of Elements and is working well for us.
Hey! Thanks for the report.
+1 here, any news on this issue?
any news? I am experiencing this same issue
@chohmann was just curious on when this issue might get fixed, thanks!
@graham-atom this is something that is on our radar, but we have no concrete dates that we can promise.
As @jernej-lipovec-viaduct mentioned, you can use this workaround:
const code = "https://api.apis.guru/v2/specs/github.com/1.1.4/openapi.yaml"; // Define the 'code' variable
return (
<div className='w-screen p-1'>
<elements-api
apiDescriptionUrl={code}
router="hash"
/>
</div>
);
In my case, I am using TypeScript, so I have added this file: elements.d.ts
// elements.d.ts
import * as React from 'react';
declare module 'react' {
namespace JSX {
interface IntrinsicElements {
'elements-api': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
apiDescriptionUrl?: string;
router?: string;
};
}
}
}
And I have added the file to my tsconfig.json.
"include": ["src", "src/types/elements.d.ts"],
Describe the bug
When using React version of elements along with React Router 6 (currently 6.2.2)
To Reproduce
Expected behavior
I would expect app to not crash when used with React Router 6.
Additional context
This error happens when regardless of "router" parameter or whether I am using apiDescriptionUrl or apiDescriptionDocument.
Environment (remove any that are not applicable):
Error stacktrace