A
A
Arkady Baganin2020-06-23 22:18:09
React
Arkady Baganin, 2020-06-23 22:18:09

How to connect a React component?

I have such a problem, I connected react and I can not connect the initial component and initialize the application...

spoiler

<!DOCTYPE html>
<html lang="ru">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script src="https://unpkg.com/[email protected]/umd/react.development.js" crossorigin></script>
  <script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" crossorigin></script>
  <script src="https://unpkg.com/[email protected]/babel.min.js"></script>
  <title>ПапаСмит - Авторизация</title>
</head>
<body>
<div id="root"></div>
<script type="text/babel" src="component/authComponent.js"></script> <!-- А вот так нет !-->
<!-- Вот работает
<script type="text/babel">
const element = <h1>Привет, мир</h1>;
ReactDOM.render(element, document.getElementById('root'));
</script>
!-->
</body>
</html>



Node.js cannot be used, because in the future there will be a python server.
What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2020-06-23
@ark_yt

Use create-react-app and build your app. How does the API server in python interfere with you? Or do you want to do SSR in python?
At the expense of SSR in python, for me it’s such a dumb idea, if you try for the sake of SEO, then for the sake of user convenience, I would write an isomorphic application.
1) Python API server
2) SSR on a node, load data, render, send to the front
3) Hydrate on the front, delete preloaded data, then work as a SPA with the user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question