Hacker News new | past | comments | ask | show | jobs | submit login

See my other reply below: I feel Slider is not a useful example because it doesn't extrapolate into any kind of real world web app -- which is a problem when this library is about helping you build real world web apps.

The scare quotes are because it's hardly a library when it provides less than 5 lines of code, as you noted.




> The scare quotes are because it's hardly a library when it provides less than 5 lines of code, as you noted.

It makes the example easier to read for me, because I can figure out what it does by the context:

1. It's called "delay"

2. It's a function that takes 1 parameter, a number

3. There is a browser API called setTimeout, which takes a function and a number

4. Converting functions that take a callback to a function that returns a promise is a common pattern.

I know what delay does without even needing to see it. Maybe if you don't know the 4 things I've listed above, this makes the example harder to read, but then you probably do not need this library.

> I feel Slider is not a useful example because it doesn't extrapolate into any kind of real world web app -- which is a problem when this library is about helping you build real world web apps.

It's an example on the homepage, not documentation. How many lines of code do you want to see? I feel like if you assume that the author wrote this to scratch their own itch, then you can use your imagination and assume that they work on apps with complicated state that needs to be persisted over a network, that gets fed to functional components.

Edit: I read your other comment, and I agree it's really hard to come up with good, non-trivial examples.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: