-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify the counter example? #50
Comments
Here it might be nice to slightly overload the https://github.com/funkia/turbine/blob/master/examples/counters/src/index.ts#L59 I've thought that was also what happened here: ...
const {inputValue: email} = yield input();
const isValid = email.map(isValidEmail);
yield div([
"The address is ", map((b) => b ? "valid" : "invalid", isValid)
]); The |
Also wouldn't say no to some more details on the "mysterious" https://github.com/funkia/turbine/blob/master/examples/counters/src/version3.ts#L66 |
Yes, it actually would. But in the next version of Hareactive
I think that is a good observation. It probably can be made into a completely reusable component.
Yes. It should already be possible to do that. I don't know why a put an explicit
Absolutely.
I'll update #53 with documentation for both |
I would also like to avoid the It is really uniquely determined by the stream itself, so the structure is the same. Any reasons against it? |
I'd be really interested in that. On the most abstract level you select an element in array, so basically its index. On the outside, you pass it array of stateful components compArray = (selectedIndex: Number): Array<Component> that would be passed to the reusable const { selected } = yield Selector(compArray) with the What do you think? |
Another more restrictive alternative would be the array of selected/unselected component pairs: const arrayOfSelectableComponents: Array<(selected: Boolean): Component> That is more focused to the common use case, |
This seems to look like the case for the
loop
:https://github.com/funkia/turbine/blob/master/examples/counters/src/index.ts#L44
That would remove the need for the model, right?
There is the conversion from stream into behaviour in the model,
I see where it comes from, but having one thing for both might possibly be simpler here?
Then it would be just one short loop :)
The component itself looks like a general purpose selector component,
to which you pass the array
labels = [1, 2, 3, 4]
,along with the child component
selectorButton
.I wonder if that can be made into something nice and reusable...
The text was updated successfully, but these errors were encountered: