mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Merge pull request #2005 from mattblackdev/devel
Allow passing multiple args to HOCs
This commit is contained in:
commit
40b91adafe
1 changed files with 5 additions and 1 deletions
|
@ -57,7 +57,11 @@ export const getComponent = (name) => {
|
|||
if (!component) {
|
||||
throw new Error(`Component ${name} not registered.`)
|
||||
}
|
||||
const hocs = component.hocs.map(hoc => Array.isArray(hoc) ? hoc[0](hoc[1]) : hoc);
|
||||
const hocs = component.hocs.map(hoc => {
|
||||
if(!Array.isArray(hoc)) return hoc;
|
||||
const [actualHoc, ...args] = hoc;
|
||||
return actualHoc(...args);
|
||||
});
|
||||
return compose(...hocs)(component.rawComponent)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue