perf: memo
This commit is contained in:
parent
0639c825a9
commit
066abec937
|
@ -1,4 +1,4 @@
|
|||
import {useCallback, useState} from 'react';
|
||||
import {memo, useCallback, useState} from 'react';
|
||||
|
||||
import {useEcsTick} from '@/react/context/ecs.js';
|
||||
|
||||
|
@ -19,6 +19,8 @@ export function Time({hour, minute}) {
|
|||
);
|
||||
}
|
||||
|
||||
const MemoTime = memo(Time);
|
||||
|
||||
function ConnectedTime() {
|
||||
const [hour, setHour] = useState(-1);
|
||||
const [minute, setMinute] = useState(0);
|
||||
|
@ -35,7 +37,7 @@ function ConnectedTime() {
|
|||
if (-1 === hour) {
|
||||
return false;
|
||||
}
|
||||
return <Time hour={hour} minute={minute} />;
|
||||
return <MemoTime hour={hour} minute={minute} />;
|
||||
}
|
||||
|
||||
export default ConnectedTime;
|
||||
|
|
Loading…
Reference in New Issue
Block a user