Replies: 4 comments 1 reply
-
For server rendering there is mithril-node-render |
Beta Was this translation helpful? Give feedback.
-
Next.js is React-specific. Fusion.js can support Mithril though. |
Beta Was this translation helpful? Give feedback.
-
On a semi-related note (and I know it's old) - @lhorie, do you have any samples of using Fusion.js with Mithril - specifically on routing? I've got the start, but I think it will require a plugin for the router otherwise it throws import App, { RenderToken } from 'fusion-core';
export default async function start() {
// Allow Mithril to work with SSR.
if (!global.window) {
global.window = global.document = global.requestAnimationFrame = undefined
}
// Require mithril after setting window.
var m = require('mithril');
m.route.prefix = '';
const mithrilrender = require('mithril-node-render');
const render = el =>
__NODE__
? mithrilrender(el)
: m.render(document.getElementById('root'), el);
const root = HomePage;
const app = new App(root);
app.register(RenderToken, render)
return app;
}
export const HomePage = () => {
var m = require('mithril');
return {
view: () =>
m('div', [
'Home page.',
m(m.route.Link, { href: '/about' }, 'About')
]),
};
}; |
Beta Was this translation helpful? Give feedback.
-
I did find a router for Mithril using the universal router and added a quick repo here of Mithril with Fusion.js: https://github.com/josephspurrier/mithril-fusion |
Beta Was this translation helpful? Give feedback.
-
Would you like to ask if next.js can be used with mithril.js? Thank you!
Beta Was this translation helpful? Give feedback.
All reactions