Skip to content

Document the requirement to attach the app to an element with the id "root" #71

Description

@BlairCooper

ReactPress requires that the app load itself into an element with the id "root" as show below. Some frameworks follow this implementation detail while other do not.

const elem = document.getElementById('root');
ReactDOM.createRoot(elem);

One example, which happened to use Webpack as the framework, used the code below for loading the app. In this case main.js defines a component which gets loaded inline. This works fine and loads the app. However, dropping the app into ReactPress will not load the app as it does not attach to the element with the id "root".

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Getting Started</title>
  </head>
  <body>
    <script src="main.js"></script>
  </body>
</html>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions