mardi 11 mai 2021

How do I pull a feature that is normally called with yield with React Hooks?

The logic I want is that if the feature is on, then I should get <Component1/> else I should get <Component2/>.

So something like:

feature ? <Component1 /> : <Component2 />;

However, feature needs to be pulled from someplace else and I'm not sure how to do that. Would I use useEffect in that case?

In another file, I get feature like this:

const { feature } = yield select(getFeatures);

But I can't do yield in my new component where I want to have the conditional logic.

Aucun commentaire:

Enregistrer un commentaire