External view files
See original GitHub issueHello there!
First of all i’d like to say that i’m super excited with this project! It’s by far the most awesome front-end framework that i’ve seen in a long time!
I come from a backend background and i usually don’t play nice with frontend standards, but i’m getting used to it…
I’d like to know how to use a separated .html file from the view, cause i can’t deal with html and js in the same file, seems so dirty… 😦
What i’m looking for would be something like:
app.js
const choo = require('choo')
const app = choo()
app.model({
state: { title: 'Set the title' },
reducers: {
update: (action, state) => ({ title: action.value })
}
})
const mainTemplate = require('./template.html');
const mainView = (params, state, send) => choo.view(mainTemplate)
app.router((route) => [
route('/', mainView)
])
const tree = app.start()
document.body.appendChild(tree)
template.html
<main>
<h1>${state.title}</h1>
<input
type="text"
oninput=${(e) => send('update', { value: e.target.value })}>
</main>
is there anything similar to this?
best, rafa
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to View the Contents of a Hard Drive
Viewing All Files · 1. Click "Organize" in the Windows Explorer toolbar and select "Folder and Search Options." · 2. Click the "View"...
Read more >Move your files to a new Windows PC using an external ...
Learn how to move files to a new Windows PC using an external storage device ... hold (or right-click) the folders, then select...
Read more >Solved: Hard Drive Not Showing Files Though They Still Exist
Don't worry if your external or internal hard drive is not showing files though they still exist. First, download EaseUS file recovery software ......
Read more >Solved – Files Not Showing In External Hard Drive [2022 ...
Open File Explorer the way you like. · Select View from the menu bar. · Click Options and choose Change folder and search...
Read more >Solved - Can't See Files in External Hard Drive - YouTube
This video tells how to show hidden files in external hard drive and how to recover effectively and quickly recover lost data with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rafaelamorim Believe me I know the feeling - there’s some really awful code out there where JS generates HTML markdown and it starts to feel really unmaintainable. But here are some things to consider:
module.exports = (params, state, send) => {}
wrapper around itYEP! it’s a “get used to that kid” case 😉 Thanks to everyone that helped me out on that.
Keep on the awesome work guys! You guys rock!
Best, Rafa