import React, { createContext } from 'react'; import { Button, Modal, Space } from 'antd'; const ReachableContext = createContext(null); const UnreachableContext = createContext(null); const config = { title: 'Use Hook!', content: ( <> {name => `Reachable: ${name}!`}
{name => `Unreachable: ${name}!`} ), }; const App: React.FC = () => { const [modal, contextHolder] = Modal.useModal(); return ( {/* `contextHolder` should always be placed under the context you want to access */} {contextHolder} {/* Can not access this context since `contextHolder` is not in it */} ); }; export default App;