Skip to content

Commit

Permalink
Merge pull request #42 from maspasov/fix/make-mobx-prop-optional
Browse files Browse the repository at this point in the history
MobxOptions prop optional
  • Loading branch information
einari authored Jul 18, 2024
2 parents 2055ce9 + 4075f41 commit 8699ca0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Source/JavaScript/Applications.React.MVVM/MVVMContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ import { MobxOptions } from './MobxOptions';

export interface MVVMProps {
children?: JSX.Element | JSX.Element[];
mobx: MobxOptions | undefined
mobx?: MobxOptions;
}

export const MVVMContext = React.createContext({});

export const MVVM = (props: MVVMProps) => {

const options: MobxOptions = { ...{ enforceActions: 'never' }, ...props.mobx || {} };
const options: MobxOptions = {
...{ enforceActions: 'never' },
...(props.mobx || {}),
};

configureMobx(options);

Bindings.initialize();

return (
<MVVMContext.Provider value={{}}>
{props.children}
</MVVMContext.Provider >
);
};
return <MVVMContext.Provider value={{}}>{props.children}</MVVMContext.Provider>;
};

0 comments on commit 8699ca0

Please sign in to comment.