Remove flux dependency (#10313)
This commit is contained in:
committed by
GitHub
parent
2631b63d13
commit
bee4759208
@@ -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) => {});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user