-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Labels
Fluent UI react-components (v9)Needs: Triage 🔍Status: Not on RoadmapIssue is not currently on roadmap, no fix plannedIssue is not currently on roadmap, no fix plannedType: Feature
Description
Library
React Components / v9 (@fluentui/react-components)
Describe the feature that you would like added
Coming from a redux environment, I was used to doing a lot of this:
const {
session,
signupMethodStr,
} = useAppCtx(ctx => ({
session: ctx.session,
signupMethodStr: ctx.session.signupMethodStr,
}));
Which is a lot nicer/cleaner that having to call the useAppCtx()
hook multiple times. This causes a too many re-renders error in ReactJS?
error though. I believe it's because new object gets created every time the selector is run. In order to fix this I had to do something hacky with the selector function:
export const useAppCtx = <T extends {}>(selector: TSlctr<T>): T => {
const ctx = useContextSelector(AppCxt, ctx => ctx);
return selector(ctx);
};
Instead of how the docs show:
export const useAppCtx = <T extends {}>(selector: TSlctr<T>): T => {
return useContextSelector(AppCxt, selector);
};
Is there any chance we get could this to work by default? Thanks.
Have you discussed this feature with our team
No
Additional context
No response
Validations
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Priority
None
Metadata
Metadata
Assignees
Labels
Fluent UI react-components (v9)Needs: Triage 🔍Status: Not on RoadmapIssue is not currently on roadmap, no fix plannedIssue is not currently on roadmap, no fix plannedType: Feature