# Invoke Callback from MFE

**URL:** <https://discuss.openedx.org/t/invoke-callback-from-mfe/14881>\
**Category:** Development\
**Created:** [January 30, 2025, 4:38pm UTC](https://discuss.openedx.org/t/invoke-callback-from-mfe/14881 "2025-01-30T16:38:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrielC1409](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/gabrielc1409/32/7795_2.png) [@gabrielC1409](https://discuss.openedx.org/u/gabrielC1409)\
**Post date:** [January 30, 2025, 4:38pm UTC](https://discuss.openedx.org/t/invoke-callback-from-mfe/14881/1 "2025-01-30T16:38:48Z")

</div>

Hello everyone, how are you?

I have a question about how the MFE can call a callback from the backend, which is the one that returns the grade to the student depending on the answer they gave in a course.

To put it in context, I am making an adjustment for Xqueue where through the callback that is in edxPlatform, through that callback it will return what the student’s grade is and thus the MFE can call the callback and show that information to the student.

If you need more information that would be useful to me, please provide it so that you can help me. I am attentive.

---

<div class="post-metadata">

**Author:** ![jill](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/jill/32/3188_2.png) [@jill](https://discuss.openedx.org/u/jill)\
**Post date:** [January 31, 2025, 3:51am UTC](https://discuss.openedx.org/t/invoke-callback-from-mfe/14881/2 "2025-01-31T03:51:54Z")

</div>

Hi @gabrielC1409 , thank you for working on XQueue 🙂

A good example can be seen in the [Authoring MFE](https://github.com/openedx/frontend-app-authoring), most recently in [library-authoring](https://github.com/openedx/frontend-app-authoring/tree/master/src/library-authoring/data).

It uses [react-query](https://tanstack.com/query/latest/docs/framework/react/overview) hooks to retrieve and update data in the backend, which [OEP-0067](https://docs.openedx.org/projects/openedx-proposals/en/latest/best-practices/oep-0067/decisions/frontend/0010-react-query.html) recommends (instead of the redux approach used in the course authoring part of that MFE, which is a lot more complicated). React-query’s [documentation](https://tanstack.com/query/latest/docs/framework/react/overview) is great too, and definitely worth a read.

For example:

- [useContentLibrary](https://github.com/openedx/frontend-app-authoring/blob/master/src/library-authoring/data/apiHooks.ts#L127-L133) will fetch a given content library, providing `isFetching` and `isLoading` flags while the data fetches/loads, before finally returning the content library itself (or an error).
- [useUpdateLibraryMetadata](https://github.com/openedx/frontend-app-authoring/blob/master/src/library-authoring/data/apiHooks.ts#L177-L204) will update a library.
- The hooks use APIs like [getContentLibrary](https://github.com/openedx/frontend-app-authoring/blob/31f39cb015a91d8527c08d6ef3ca25b2b44b76b7/src/library-authoring/data/api.ts#L263-L266) to make the actual backend calls, and [query keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) like [libraryAuthoringQueryKeys.contentLibrary](https://github.com/openedx/frontend-app-authoring/blob/master/src/library-authoring/data/apiHooks.ts#L71) to let react-query know when data has changed, so it can invalidate previous queries and automatically re-load data shown in the UI.
- [getAuthenticatedHttpClient](https://github.com/openedx/frontend-app-authoring/blob/31f39cb015a91d8527c08d6ef3ca25b2b44b76b7/src/library-authoring/data/api.ts#L2) from `@edx/frontend-platform/auth` takes care of authentication.
