liferay-labs-br / fiber

The framework specialized in animated components.
MIT License
5 stars 4 forks source link

[THOUGHT] Abstract render #36

Closed matuzalemsteles closed 7 years ago

matuzalemsteles commented 7 years ago

Disclaimer

Just a thought

This pr is just a thought to abstract the render in renderers/render to isomorphic/render.

Just a thought in creating a generic layer of render for anyone to create a package on top of the public render API and create different types of renderers. there is still much to write.

How to use

To create a render just import renderFactory:

import renderFactory from '../isomorphic/render';

Use as a callback, for example:

const myrender = (vnode) =>
  renderFactory = (vnode, (args) => {
      /* Your code... */
  });

renderFactory returns an args that can be object or string.

string

When vnode returns string. In the case of a render-dom, when called recursively passing the child.

object

vnode is the vnode. :) component is the instance of the component, to pass a bind to events for example.

matuzalemsteles commented 7 years ago

Hey @clovisdasilvaneto,

This is not to be merged. It's just a study I'm working on 😅. I will revert so that you can merge the other pr.