Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FaCC composition #77

Open
streamich opened this issue May 3, 2018 · 3 comments
Open

FaCC composition #77

streamich opened this issue May 3, 2018 · 3 comments
Assignees

Comments

@streamich
Copy link
Contributor

Implement FaCC composition helper, as suggested here:

const wrap = (faccs, params, callback) => {
  if (!faccs.length) {
    return callback(...params);
  }

  const [Comp, ...restFaccs] = faccs;

  return React.createElement(Comp, null, (...args) => {
    params.push(args.length > 1 ? args : args[0]);
    return wrap(restFaccs, params, callback);
  });
};

const userspaceSolution = (...args) =>
  wrap(args.slice(0, args.length - 1), [], args[args.length - 1]);
@streamich streamich self-assigned this May 3, 2018
@streamich streamich added this to To do in libreact Board via automation May 3, 2018
@streamich streamich moved this from To do to In progress in libreact Board May 4, 2018
@ackvf
Copy link

ackvf commented May 9, 2018

This structure seems too complex for my understanding, can you also show example usage? Also it should be FaaC - Function as a Child

@streamich
Copy link
Contributor Author

@ackvf Here is an example usage: reactjs/rfcs#47 (comment)

@streamich
Copy link
Contributor Author

FaCC — Function as Child Component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
libreact Board
  
In progress
Development

No branches or pull requests

2 participants