mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
remove unnecessary useEffect
This commit is contained in:
parent
f573565348
commit
199c01a377
@ -58,14 +58,6 @@ const JsonEditor: React.FC = () => {
|
|||||||
};
|
};
|
||||||
}, [json]);
|
}, [json]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (settings.autoformat) {
|
|
||||||
return setValue(JSON.stringify(JSON.parse(json), null, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
setValue(json);
|
|
||||||
}, [settings.autoformat, json]);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const formatTimer = setTimeout(() => {
|
const formatTimer = setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
@ -86,7 +78,7 @@ const JsonEditor: React.FC = () => {
|
|||||||
}, 1800);
|
}, 1800);
|
||||||
|
|
||||||
return () => clearTimeout(formatTimer);
|
return () => clearTimeout(formatTimer);
|
||||||
}, [value, settings.autoformat, dispatch]);
|
}, [value, settings.autoformat, dispatch, json]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledEditorWrapper>
|
<StyledEditorWrapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user