Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for React < 18 #53

Open
JonathanAriass opened this issue Jul 14, 2024 · 5 comments
Open

Support for React < 18 #53

JonathanAriass opened this issue Jul 14, 2024 · 5 comments

Comments

@JonathanAriass
Copy link

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.

@jaywcjlove
Copy link
Member

@JonathanAriass If we can support <18 without useId, I think we can accomplish this task.

@EliazTray
Copy link

@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)

@jaywcjlove
Copy link
Member

@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;

@jaywcjlove
Copy link
Member

@JonathanAriass @EliazTray Upgrade v2.0.0-alpha.27

github-actions bot pushed a commit that referenced this issue Sep 3, 2024
@EliazTray
Copy link

@JonathanAriass @EliazTray Upgrade v2.0.0-alpha.27

It took effect on [email protected] !
Thanks for your quickly reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants