trivago / melody

Melody is a library for building JavaScript web applications.
https://melody.js.org
Apache License 2.0
215 stars 38 forks source link

melody-hooks requires using melody-component for rendering root component #76

Open pago opened 6 years ago

pago commented 6 years ago

Explain the problem

When trying to mount a root component written using the melody-hooks API, we still need to rely on melody-component in order to render the root component.

Expected Behaviour

There is a way to render a top-level component from melody-hooks without having to rely on melody-component.

import { render } from 'melody-hooks';
import home from './home';

const documentRoot = document.getElementById('root');
render(documentRoot, home, {
    message: 'Welcome to Melody!'
});

Actual Behaviour

The only way to render a top-level melody-hooks component is by using render from melody-component.

import { render } from 'melody-component';
import home from './home';

const documentRoot = document.getElementById('root');
render(documentRoot, home, {
    message: 'Welcome to Melody!'
});

Provide your Environment details

malte-wessel commented 5 years ago

I see three options here:

  1. Create a melody-render package
  2. Move render logic to melody-idom
  3. Duplicate render logic in melody-hooks.

I would go for option 2, since a lot of component logic is already in melody-idom. What do you think?