Skip to content

Language change bug in React #14

@liang0000

Description

@liang0000

We encountered an issue that language is not changing in React while using your current example in documentation. Is it a bug or intended behaviour? Or are we implementing this library incorrectly?

Here is an interactive example: https://codesandbox.io/s/uc8gld

Above example code is using below code and already have solution by using widget.current.loadLanguage(languageCode)

useEffect(() => {
  if (!widget.current && container.current) {
    widget.current = new WidgetInstance(container.current, {
      startMode: "auto",
      doneCallback: doneCallback,
      errorCallback: errorCallback,
      language: language,
    });
  }
  return () => {
    if (widget.current !== undefined) widget.current.reset();
  };
}, [container, language]);

But also an issue for

    const captHook = useCaptchaHook({
    siteKey: siteKey,
    endpoint: 'GLOBAL1',
    language: languageCode,
    startMode: 'none',
    showAttribution: false,
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions