Skip to content

Commit f7cc2a1

Browse files
committed
refactor: assign the final object to a variable called Typist
1 parent 7ecdcc6 commit f7cc2a1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/components/Typist.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Paste from './Paste';
1111

1212
import TypistCore from '../TypistCore';
1313

14-
const Typist = ({ cursor, disabled = false, restartKey, ...coreProps }: TypistProps) => {
14+
const Main = ({ cursor, disabled = false, restartKey, ...coreProps }: TypistProps) => {
1515
const { children, splitter = defaultSplitter } = coreProps;
1616
const [typedLines, setTypedLines] = useState<TypedLines>([]);
1717
const typistCoreRef = useRef<TypistCore>();
@@ -37,6 +37,7 @@ const Typist = ({ cursor, disabled = false, restartKey, ...coreProps }: TypistPr
3737

3838
// Don't add other properties to the dependencies array because
3939
// it will cause re-creating instance whenever `props` changes.
40+
// eslint-disable-next-line react-hooks/exhaustive-deps
4041
}, [disabled, restartKey]);
4142

4243
// Update the typistCore's props whenever component's props change
@@ -48,4 +49,6 @@ const Typist = ({ cursor, disabled = false, restartKey, ...coreProps }: TypistPr
4849
return <>{cursor ? insertCursor(typedChildren, cursor) : typedChildren}</>;
4950
};
5051

51-
export default Object.assign(Typist, { Backspace, Delay, Paste });
52+
const Typist = Object.assign(Main, { Backspace, Delay, Paste });
53+
54+
export default Typist;

0 commit comments

Comments
 (0)