Remove flux dependency (#10313)

This commit is contained in:
Michael Telatynski 2023-03-08 14:19:05 +00:00 committed by GitHub
parent 2631b63d13
commit bee4759208
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 231 additions and 109 deletions

View file

@ -15,15 +15,12 @@ limitations under the License.
*/
import { useEffect, useRef } from "react";
import { Dispatcher } from "flux";
import { ActionPayload } from "../dispatcher/payloads";
import { MatrixDispatcher } from "../dispatcher/dispatcher";
// Hook to simplify listening to flux dispatches
export const useDispatcher = (
dispatcher: Dispatcher<ActionPayload>,
handler: (payload: ActionPayload) => void,
): void => {
// Hook to simplify listening to event dispatches
export const useDispatcher = (dispatcher: MatrixDispatcher, handler: (payload: ActionPayload) => void): void => {
// Create a ref that stores handler
const savedHandler = useRef((payload: ActionPayload) => {});