Comments (4)
@markgarrigan why should <div id="root">
be better than simply <app></app>
? Could you please provide more info?
from riot.github.io.
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.
@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.
@markgarrigan thank you for your PR. We can close this issue
from riot.github.io.
Related Issues (20)
- V4 docs: ES5 examples HOT 1
- Is riot.js v4 unable to compile inline tags/components in the browser? HOT 5
- Riot.js@4 Japanese translation of indexes (見出しの翻訳について) HOT 1
- Link to v3 documentation broken HOT 3
- Expression with logical AND operator fails to compile(In-browser compile with inline templates) HOT 5
- Documentation clarifications around component lifecycle and mounting HOT 4
- Add documentation about the new HOC components in Riot.js 4.6.0
- Browser support needs more detailed information HOT 4
- double children doms when run both ssr.fragments and riot.mount ? HOT 7
- RiotControl in v4 riotjs HOT 2
- Issue using is= to mount components HOT 3
- Add documentation about "default" slot HOT 2
- npm i by default saves packages as dependencies HOT 1
- update won't work well withTextarea inner text HOT 3
- Could you please add the latest version number on the front page of riot? HOT 1
- Typo, maybe rephrase this paragraph a bit. HOT 1
- riot.version instead of riot.version() HOT 1
- Sass Preprocessor Example Uses Deprecated Sass Package HOT 3
- Suggestion: cute version of Riot logo inspired by cute version of React logo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riot.github.io.