Comment by mickael-kerjean
2 days ago
> Do you think the code can be extended and maintained by someone other than you? How about a large team?
There's no track record of it but I believe it would be ok in the right team. The core idea was stolen from every other frameworks: "build your app as a tree of components". In the approach I went with, components are modular and expressed like this:
```
export default function (render, props = {}) {
render($domNode)
}
```
in practice, a working code loading another component would be:
```
import FooCompoment from "./component_foo.js";
export default function (render, props = {}) {
const $node = createElement(`
<div>
<div data-bind="component_foo"></div>
Name: ${props.name}
</div>
`);
// render the component with an animation
render(transition($node));
// render a child component
FooComponent(
createRender($node.querySelector(`[data-bind="component_foo"]`)),
{ ...props },
);
}
```
The syntax is arguably less nice than JSX but the upside is 0 running cost and the idea around decoupling components remain. A lot of people have argue that I just end up maintaining my own framework but the reality is what would be considered "framework code" fit under 200 lines of code ....
No comments yet
Contribute on Hacker News ↗