-
Notifications
You must be signed in to change notification settings - Fork 780
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
Passing arguments to init #1082
Comments
Yes this is certainly an error. It still works because init behaves like an action but the state will be undefined. So problems will be set to 99, for use in the effect. But there is no reason why an example in the docs should be so confusing |
You can't pass arguments to Hyperapp's init function. That's simply a way to create a variable with a default value without const/let. It should be noted, though. |
OK I hope the docs can be amended there |
If you see closely, your suggestion is actually a runtime error. |
In the second example here
https://github.com/jorgebucaran/hyperapp/blob/main/docs/api/app.md#init
I am not clear how would one pass an argument (
problems
) to Init ? I cannot find anything in the docsIf there is no way to pass a different
problems
to the default wouldn't it be better to do:Also on the same page it says init is required 100% but later says "Note that if you leave init: undefined the state will be set to an empty object ({}) by default" so I think one of these is wrong ?
?
The text was updated successfully, but these errors were encountered: