Ошибка «Ожидается, что React.Children. Получит только один дочерний элемент React». с помощью react-redux и Auth0 - PullRequest
0 голосов
/ 27 мая 2020

У меня есть следующая инициализация React:

ReactDOM.render(
  <React.StrictMode>
    <Auth0Provider
      domain={config.domain}
      client_id={config.clientId}
      redirect_uri={window.location.origin}
      onRedirectCallback={onRedirectCallback}
    >
      <Provider store={store}>
        <App />
      </Provider>
    </Auth0Provider>
  </React.StrictMode>,
  document.getElementById('root')
);

Но я получаю сообщение об ошибке, когда запускаю этот код, который изначально был создан с использованием CRA и изменен, как указано на сайте Auth0:

Unhandled Rejection (Error): React.Children.only expected to receive a single React element child.
▶ 19 stack frames were collapsed.
initAuth0
.../src/react-auth0-spa.js:41
  38 |        setUser(user);
  39 |      }
  40 | 
> 41 |      setLoading(false);
     | ^  42 |    };
  43 |    initAuth0();
  44 |    // eslint-disable-next-line
View compiled
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.  Click the 'X' or hit ESC to dismiss this message.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...