Skip to content
You must be logged in to vote

I think the problem is that the focus method is beeing called before the component is initialized. You can try adding a ref to an input like that:

<input ref={inputRef}  ... />

and then inside the useEffect hook

...

  const inputRef = useRef()

  useEffect(() => {
    (async () => {
      const { initTE, Input, Select } = await import('tw-elements');
      initTE({ Input, Select });

      inputRef.current.focus()
    })();
  }, []);

...

Let me know if that helped

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@JustARatherRidiculouslyLongUsername
Comment options

@juujisai
Comment options

Answer selected by filipkappa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants