feat: add feature guard as hook and component.

This commit is contained in:
a.bouhuolia
2022-02-13 16:29:50 +02:00
parent fdd52f1ecf
commit 9b7befc544
12 changed files with 134 additions and 39 deletions

View File

@@ -0,0 +1,13 @@
import React from 'react';
import * as R from 'ramda';
import withFeatureCan from './withFeatureCan';
function FeatureCanJSX({ feature, children, isFeatureCan }) {
return isFeatureCan && children;
}
export const FeatureCan = R.compose(
withFeatureCan(({ isFeatureCan }) => ({
isFeatureCan,
})),
)(FeatureCanJSX);