Skip to content

Conversation

lotrien
Copy link
Member

@lotrien lotrien commented Jun 19, 2019

No description provided.

@lotrien lotrien requested review from ikalnytskyi and Snizhana June 19, 2019 12:20
@@ -70,14 +70,14 @@ const NewSnippet = ({ dispatch, history, syntaxes }) => {
const handleSyntax = syntax => ({ syntax })
const handleContent = content => ({ content })

const getSyntaxes = () => {
const memoizedSyntaxes = useMemo(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of using useMemo()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useMemo will memorize result of passed function and will be re-rendered only if syntaxes has changed.

@@ -15,21 +15,21 @@ const useForm = (cb, validate) => {
}
}, [error, isSubmitting])

const handleSubmit = useCallback(e => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why useCallback has been removed?

Copy link
Member Author

@lotrien lotrien Jun 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in our case without second parameter this hook does not have sense.

@lotrien lotrien merged commit 13c2ea6 into master Jun 19, 2019
@lotrien lotrien deleted the useMemo branch June 19, 2019 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants