Replies: 5 comments
-
|
the compiler needs to know if something is a component vs a function since ripple is not jsx. Ripple supports multiple components per file, you could have a mixture of components and regular JavaScript functions. So ripple needs to know which functions are components and which functions are regular functions. And it’s because, unlike in react, where regular functions just return JSX, ripple functions essentially use JS directly without returning anything, in the form of this JSX-like syntax. |
Beta Was this translation helpful? Give feedback.
-
|
I feel like this might stray too far from TSX, it might confuse newcomers. I think Ripple could benefit more from having a much more simple syntax. |
Beta Was this translation helpful? Give feedback.
-
|
Ripple has a new and unique approach. To learn Ripple, we need to unlearn what we know about other frameworks. |
Beta Was this translation helpful? Give feedback.
-
|
@RATIU5 I partially agree with on this, the different arrow does feel off, i just thought of this different way of writing it let Button = component () => {}this shorthand would be too useful to not consider because of this reason |
Beta Was this translation helpful? Give feedback.
-
|
One of the implicit parts of arrow functions is that they don't require a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Idea
just like we have arrow functions in Javascript to define functions and especially callbacks, a similar concept could be implemented for components.
Why
arrow functions are much cleaner to read and they make it much more natural to think of them as "first-class citizen", pass them around in variables and as callbacks.
Propsed syntax:
or
or any other variation on this
Beta Was this translation helpful? Give feedback.
All reactions