Skip to content

Commit

Permalink
upgrade eventin
Browse files Browse the repository at this point in the history
  • Loading branch information
mebtte committed Nov 15, 2023
1 parent be31af3 commit c2dcd90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
21 changes: 1 addition & 20 deletions apps/pwa/src/utils/x_state.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, ComponentType } from 'react';
import { useState, useEffect } from 'react';
import Eventin from 'eventin';

enum EventType {
Expand Down Expand Up @@ -51,25 +51,6 @@ class XState<State> {

return state;
}

withState<
PropName extends string,
Props extends { [key in PropName]: State },
>(propName: PropName, Component: ComponentType<Props>) {
const self = this;
return function ComponentWithXState(props: Omit<Props, PropName>) {
const state = self.useState();
return (
// @ts-expect-error
<Component
{...{
...props,
[propName]: state,
}}
/>
);
};
}
}

export default XState;
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eventin": "^1.2.0",
"eventin": "^2.0.1",
"file-saver": "^2.0.5",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"html-webpack-plugin": "^5.5.1",
Expand Down

0 comments on commit c2dcd90

Please sign in to comment.