Giter Site home page Giter Site logo

v4 Documentation about riot.github.io HOT 4 CLOSED

markgarrigan avatar markgarrigan commented on August 20, 2024
v4 Documentation

from riot.github.io.

Comments (4)

GianlucaGuarini avatar GianlucaGuarini commented on August 20, 2024

@markgarrigan why should <div id="root"> be better than simply <app></app>? Could you please provide more info?

from riot.github.io.

markgarrigan avatar markgarrigan commented on August 20, 2024

It isn't a question of which is better. It's a question of which is correct for the documentation. I'm speaking of the documentation at https://riot.js.org/documentation/

index.html

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

app.riot

<app>
  <p>{ props.message }</p>
</app>

main.js

import * as riot from 'riot'
import App from './app.riot'

const mountApp = riot.component(App)

const app = mountApp(
  document.getElementById('root'),
  { message: 'Hello World' }
)

This wouldn't work because there is no document.getElementById('root'). So either <div id="root"></div> should be added to index.html or main.js should be changed to document.querySelector('app').

Unless it some how works they way it is documented, then I'm sorry for bringing it up. But, when I try to use the currently documented code it doesn't work.

For example take a look at this: https://github.com/riot/examples/tree/gh-pages/rollup.

From the Rollup example repo...

index.html

<!doctype html>
<html>

  <head>
    <title>Riot with Rollup</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  </head>

  <body>
    <div id="root"></div>
    <script src="dist/bundle.js"></script>
  </body>

</html>

src/main.js

import {component} from 'riot'
import App from './app.riot'

component(App)(document.getElementById('root'))

from riot.github.io.

GianlucaGuarini avatar GianlucaGuarini commented on August 20, 2024

@markgarrigan thank you for pointing this out your are right! I will transfer this issue here and you could also try to contribute making a PR, otherwise I will fix it asap.

from riot.github.io.

GianlucaGuarini avatar GianlucaGuarini commented on August 20, 2024

@markgarrigan thank you for your PR. We can close this issue

from riot.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.