-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use mql as fetcher #162
Conversation
@@ -51,7 +51,7 @@ function Microlink (props) { | |||
isLoadingUndefined ? true : loadingProp | |||
) | |||
const [cardData, setCardData] = useState({}) | |||
const apiUrl = useMemo(() => createApiUrl(props), [props]) | |||
const [apiUrl, apiUrlProps] = useMemo(() => getApiUrl(props), [props]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getApiUrl
is returning two tings:
apiUrl
(string): The API url for doing the GET request.apiUrlProps
(object): some options to be pass tofetch
(likeheaders
, etc).
Since this is directly used by useCallback
props, I'm not sure if the best thing here is to split them into two different things (the current approach) or pass it as a whole thing, like:
const apiUrlProps = useMemo(() => getApiUrl(props), [props])
// passing it to fetcher
fetchFromApi(props.url, ...apiUrlProps)
// later, on props over `useCallback`
[canFetchData, setData, ...apiUrlProps])
thoughts? 🤔
tests are failing because I need to update snapshots, but first I need your feedback 😂 |
8a41cee
to
a69e673
Compare
No description provided.