import { Plugin } from '@root'
import {
useRef,
useState,
useCallback
} from 'react'
const Application = () => {
const fetchAction = useRef(getAction('my-fetch-action'))
const loggerAction = useRef(getAction('my-logger-action'))
const [data, setData] = useState(null)
const handleOnLoadMore = useCallback(() => {
fetchAction.current('www.my-data.endpoint.com/json')
.then(payload => {
setData(payload)
})
.catch(error => {
loggerAction.current(error)
})
}, [])
return (
<button onClick={handleOnLoadMore}>
{'Load more'}
</button>
)
}
export {
Application
}