Open JonathanAriass opened 2 months ago
@JonathanAriass If we can support <18 without useId, I think we can accomplish this task.
@jaywcjlove Can we use 'useId' for React 18 and only support client-side for React < 18? refer https://github.com/react-component/util/blob/7aaa1d88174b30d7fb9c94b41b7a34cea5fc37f3/src/hooks/useId.ts#L43)
@EliazTray If this is the only issue, I can handle it easily.
import { useRef } from 'react';
function useIdCompat() {
const idRef = useRef(null);
if (idRef.current === null) {
idRef.current = 'custom-id-' + Math.random().toString(36).substr(2, 9);
}
return idRef.current;
}
export default useIdCompat;
@JonathanAriass @EliazTray Upgrade v2.0.0-alpha.27
@JonathanAriass @EliazTray Upgrade
v2.0.0-alpha.27
It took effect on React@16.13.1
!
Thanks for your quickly reply.
Can we expect support for React < 18 in the future? I see that
useId
hook is being used and it is only available in React 18.