mobx-react#inject JavaScript Examples
The following examples show how to use
mobx-react#inject.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FiltersPane.js From dm2 with Apache License 2.0 | 6 votes |
buttonInjector = inject(({ store }) => {
const { viewsStore, currentView } = store;
return {
viewsStore,
sidebarEnabled: viewsStore?.sidebarEnabled ?? false,
activeFiltersNumber: currentView?.filtersApplied ?? false,
};
})
Example #2
Source File: DynamicPreannotationsControl.js From label-studio-frontend with Apache License 2.0 | 6 votes |
DynamicPreannotationsControl = inject("store")(observer(({ store }) => {
return store.autoAnnotation && !store.forceAutoAcceptSuggestions ? (
<Block name="dynamic-preannotations-control">
<Input
type="checkbox"
checked={store.autoAcceptSuggestions}
label="Auto accept annotation suggestions"
onChange={(e) => store.setAutoAcceptSuggestions(e.target.checked)}
waiting={store.awaitingSuggestions}
labelProps={{
placement: 'right',
}}
/>
</Block>
) : null;
}))
Example #3
Source File: index.js From choerodon-front-base with Apache License 2.0 | 6 votes |
StoreProvider = injectIntl(inject('AppState')(
(props) => {
const { AppState: { currentMenuType: { type, id } }, intl, children, context: { applicationId } } = props;
const intlPrefix = 'project.application-management.list';
const projectServiceDataSet = useMemo(() => new DataSet(ApplicationServiceDataSet({ id, intl, intlPrefix, applicationId, type: 'project' })), [id]);
const sharedServiceDataSet = useMemo(() => new DataSet(ApplicationServiceDataSet({ id, intl, intlPrefix, applicationId, type: 'shared' })), [id]);
const value = {
...props,
prefixCls: 'application-management',
intlPrefix,
sharedServiceDataSet,
projectServiceDataSet,
};
return (
<Store.Provider value={value}>
{children}
</Store.Provider>
);
},
))
Example #4
Source File: Annotators.js From dm2 with Apache License 2.0 | 5 votes |
UsersInjector = inject(({ store }) => {
return {
users: store.users,
};
})
Example #5
Source File: Controls.js From label-studio-frontend with Apache License 2.0 | 5 votes |
controlsInjector = inject(({ store }) => {
return {
store,
history: store?.annotationStore?.selected?.history,
};
})