Comments (5)
@0kku coming from a react background, this approach seems nice and I guess it feels cleaner, and I’d enjoy writing components this way, but in my opinion, the thing that makes me love destiny is how native it is, everything nowadays are just polyfills and ‘fake native implementations’, a component not being a class and not being able to extend a html element does quite the opposite, it removed the native aspect of it and possibly feels like ‘magic’
I’m torn, but would be curious to hear you thoughts on the above
from destiny.
@0kku coming from a react background, this approach seems nice and I guess it feels cleaner, and I’d enjoy writing components this way, but in my opinion, the thing that makes me love destiny is how native it is, everything nowadays are just polyfills and ‘fake native implementations’, a component not being a class and not being able to extend a html element does quite the opposite, it removed the native aspect of it and possibly feels like ‘magic’
I’m torn, but would be curious to hear you thoughts on the above
Just to be clear: the component would still extend HTMLElement after instantiation, but wouldn't be doing so until after the component has been passed to the template. The intention of the idea was for it to convert the function into a class that extends HTMLElement under the hood. However, I do see your concerns regardless. Also, this conversion would be a non-zero amount of work, so technically it would have slightly more overhead as well.
from destiny.
By the way, something like this would already work for things that don't require lifecycle hooks, since all these things are nothing but JS values:
import { html } from "destiny";
function myTemplate (defaultName: string) {
const who = reactive(defaultName);
return html`
<label>What's your name? <input type="text" value=${who} /></label>
<p>
Hello, ${who}!
</p>
`;
}
function anotherTemplate () {
return html`
<h1>Demo</h1>
${myTemplate("visitor")}
`;
}
document.body.append(anotherTemplate().content);
from destiny.
Yeah fair enough, I do see the functional components being nicer in every way, plus I guess it means you pass in values (like above) as opposed to using custom attributes
I’m warming towards functional components now :) imo
from destiny.
Closed as infeasible and too magical (the bad kind).
from destiny.
Related Issues (20)
- Add withReversed to ReadonlyReactiveArray
- Implement ci
- Reach acceptable test coverage
- Review eslint config
- Investigate use of a formatter
- Review codebase for refactoring opportunities
- Investigate splitting project into DOM and reactivity parts
- Publish preminified/prebundled versions
- Publish on NPM
- Type checking for templates
- Performance regression in slice
- Support reactive arguments in slice
- Investigate perf improvements to flatMap
- Lingering rendering nodes
- ReactiveValues should probably flatten
- ReactiveValue<boolean>::toggle()?
- Implement ReadonlyReactiveArray::groupBy()
- Investigate safer "protected" fields
- Investigate easing restrictions on computed()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from destiny.