Can I Mithril for server-side components? #2908
Replies: 3 comments
-
I am leaving react.js for mithril as all the SPA frameworks nowadays are focusing on SSR and server component. In fact there are many use cases for client-side only(do not care about SEO at all), I hope mithril stays the way it is, be the best lightweight CSR SPA forward. |
Beta Was this translation helpful? Give feedback.
-
I wanted to follow up on this, as I need to make the decision soon (The decision: to use React or Next instead...gasp!) To summarize my situation: my component code must live on the server. Pushing these components to clients is the product, so this is a hard requirement (I not doing some weird SEO thing) I don't own the client., but can only provide a code snippet to the client dev. Using Mithril would be ideal because it is so lightweight. To nail down what I'm hoping for, the client code should look something like this:
Looks pretty normal so far. The trick is the server endpoint, which might look like:
The server needs to return something the client's mithril can mount. Is this possible? From what I can tell, magicallyRenderedComponent doesn't exist. (When I first started, I discovered mithril-node-render, but it appears to only return the html tagging and strips out all the js code so that won't do. ) |
Beta Was this translation helpful? Give feedback.
-
GIving up. |
Beta Was this translation helpful? Give feedback.
-
I am using Mithril to build a website for what I hope to turn into a simple Saas. Currently I have a client component (in the format <Foo attr="some attr" />) whose code I would ultimately like to reside on a server and called by any client.
Can I do this with Mithril? Seems like all I need is to somehow serve a js script, which is what a Mithril ultimately boils down to.
Most of my experience has been client side, so apologies if this is a dumb question. My research so far hasn't panned out. Not knowing the right lingo doesn't help.
Possible alternatives I have found so far: Use mithril and Fusion.js, use Next.js, or perhaps just use Node+Express. Do any of these sound right?
But client side at least, Mithril has been perfect for my component and I love that it doesn't require (or even benefit from) all the complexity of React-based solutions.
Beta Was this translation helpful? Give feedback.
All reactions