question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The recent update to make this a generator looks great. An example would be even greater 😃

I’ve managed to build a runtime using s-js. It only exports a single {wrap} function.

Next I copy that runtime as and use it in a new project ‘s-jsx/index.js’ (using rollup + the babel-jsx… plugin). A simple build where I import import S from 's-js'; import { wrap } from './s-jsx'; and run console.log('Hello World') works fine… When I create a “dumb” component (no data just a static message) and use S.root(()=>…) it also works fine As soon as I start using S to add some data and render it in my component, it screams out “Can’t find variable: r” Last week, r, root, selectEach and selectWhen would all have been exported by the runtime I built; but no longer. The question is - where’s it hiding now?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ryansolidcommented, May 11, 2019

Great I’m glad you got things working. Yeah I mean while it’s possible I don’t think I’d want to be writing that close to the metal. I still like the declarative format. The best approach to almost Vanilla I’ve seen is https://github.com/Freak613/stage0, but it isn’t for me. Too manual wiring up your own update functions.

I just tried to publish s-jsx just now on npm but it said the name was too similar to a different repo. So I will need to rename it which is awkward since s-jsx is the perfect name. I have no idea what to call it. Atleast you can access it from github for now until I can think of something.

0reactions
andymanscommented, May 11, 2019

Finally got it working! Because of the dopey way I’d set up my project I needed to:

import * as s from ‘./s-jsx’` (my own custom build of dom-expressions)

and then in rollup-config:

"plugins": [["jsx-dom-expressions", {moduleName: 's'}]]

That worked; but obvs was totally brutal. Your new s-jsx repo is far neater!

The value I’m seeing here is that your approach:

  1. can really help people to get off the crack cocaine that is ‘virtual dom’
  2. do so without locking themselves into a “framework”
  3. allows 1 & 2 with almost zero performance trade-off

Perhaps I can build something with a slightly smaller bundle size, and a little more perf, if I write some optimized (ouch!) vanilla js. BUT - let’s say I want to add ‘i18n’ to my app. How do I do that in vanilla? Well, I need to react EVERY time either my language or my data changes, laboriously executing an update on every element that is affected (pseudocode):

elem.textContent = You have **count** new count !=1?"messages":"message"

The alternative in your approach:

<p>{(i18n('messageCount', state.countOfMessages))}</p>

…where i18n is a trivially simple function that returns a value from a hash accepting a key and optional count param (if pluralization needed).

Being able to do this is a total “god-send” compared to doing the same in vanilla!

Great work on Solid btw! It’s really cool. But I like this lightweight approach too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Example Definition & Meaning - Merriam-Webster
an instance (such as a problem to be solved) serving to illustrate a rule or precept or to act as an exercise in...
Read more >
Example Definition & Meaning - Dictionary.com
a pattern or model, as of something to be imitated or avoided: to set a good example. an instance serving for illustration; a...
Read more >
EXAMPLE | definition in the Cambridge English Dictionary
a person or a way of behaving that is considered suitable to be copied: He's a very good example to the rest of...
Read more >
Example definition and meaning | Collins English Dictionary
An example of something is a particular situation, object, or person that shows that what is being claimed is true. The doctors gave...
Read more >
example - Wiktionary
Something that is representative of all such things in a group. · Something that serves to illustrate or explain a rule. · Something...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found