Do not inject servers state or actions

This commit is contained in:
Alejandro Celaya
2025-11-14 19:23:48 +01:00
parent ae7aea0e2c
commit a7f2d3224b
38 changed files with 292 additions and 375 deletions

View File

@@ -19,10 +19,11 @@ export const renderWithStore = (
element: ReactElement,
{ initialState = {}, ...options }: RenderOptionsWithState = {},
) => {
const Wrapper = ({ children }: PropsWithChildren) => (
<Provider store={setUpStore(initialState)}>
{children}
</Provider>
);
return renderWithEvents(element, { ...options, wrapper: Wrapper });
const store = setUpStore(initialState);
const Wrapper = ({ children }: PropsWithChildren) => <Provider store={store}>{children}</Provider>;
return {
store,
...renderWithEvents(element, { ...options, wrapper: Wrapper }),
};
};