added float contaxt , action can take form any component
This commit is contained in:
parent
cd487dee49
commit
39ef265b56
15
src/Context/FabContext.jsx
Normal file
15
src/Context/FabContext.jsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import React, { createContext, useContext, useState } from "react";
|
||||||
|
|
||||||
|
const FabContext = createContext();
|
||||||
|
|
||||||
|
export const FabProvider = ({ children }) => {
|
||||||
|
const [actions, setActions] = useState([]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FabContext.Provider value={{ actions, setActions }}>
|
||||||
|
{children}
|
||||||
|
</FabContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useFab = () => useContext(FabContext);
|
Loading…
x
Reference in New Issue
Block a user