Remove flux dependency (#10313)
This commit is contained in:
parent
2631b63d13
commit
bee4759208
10 changed files with 231 additions and 109 deletions
|
@ -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) => {});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue