Skip to content

Commit

Permalink
fix(): move function out of hook scope
Browse files Browse the repository at this point in the history
  • Loading branch information
tetogomez committed Oct 30, 2020
1 parent 8bbf668 commit 0bea7b4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/routes/Evodex/BackLayer/Liquidity/LiquidityBackLayer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useCallback } from 'react'
import PropTypes from 'prop-types'
import clsx from 'clsx'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -313,19 +313,19 @@ const LiquidityBackLayer = ({
setLoading(false)
}

useEffect(() => {
const getCurrentSupply = async () => {
const currentSupply = await evolutiondex.getCurrentSupply(
ual,
youGive.selectValue
)
const getCurrentSupply = useCallback(async () => {
const currentSupply = await evolutiondex.getCurrentSupply(
ual,
youGive.selectValue
)

setCurrentSupplyValue(currentSupply)
}
setCurrentSupplyValue(currentSupply)
}, [ual, youGive.selectValue])

useEffect(() => {
getCurrentSupply()
setPair(pairs.find((pair) => pair.token === youGive.selectValue))
}, [pairs, youGive.selectValue])
}, [pairs, youGive.selectValue, getCurrentSupply])

useEffect(() => {
setError('')
Expand Down

0 comments on commit 0bea7b4

Please sign in to comment.