synacor / preact-i18n

Simple localization for Preact.
BSD 3-Clause "New" or "Revised" License
205 stars 18 forks source link

IntlProvider doesn't even render children components. #55

Closed skoshx closed 2 years ago

skoshx commented 3 years ago

This has been frustrating trying everything to get this to work, since l18n is something I need. I have a basic app just to get everything working, but it doesn't even work, even if its the same as in the examples in the documentation... Snippet:

render() {
    console.log("This prints");
    const AppB = () => {
      console.log("This doesn't even print for some reason");
      return (
        <div id="app">
          <div>content</div>
        </div>
      );
    }
    return (
      <IntlProvider definition={defaultDefinition}>
        <AppB />
      </IntlProvider>
    );
  }

AppB functional component is not rendered, ITS NOT EVEN BEING CALLED, somehow?!

pl12133 commented 3 years ago

You may need to check that your version of preact is in sync with your preact-i18n version. If you have preact>=10 you will want to use the preact-i18n@preactx version with npm install preact-i18n@preactx.

I think it may have been a long enough time that we can cut over the preactx tag to the latest version so people don't run into this too often.