I recently started using React and Fluent UI, and I encountered an issue when trying to open a modal. I have loaded all my files from CDNs but the modal doesn't seem to open when executing the code below. I've tried looking for examples, but haven't found a solution yet. Below is the code snippet:
const { DefaultButton,Fabric,Modal,IconButton} = window.FluentUIReact;
const app = () =>{
var isModalOpen = false;
function showModal(){
isModalOpen = true;
}
function hideModal(){
isModalOpen = false;
}
return (
<Fabric applyThemeToBody>
<DefaultButton onClick={showModal}>Make a Poll</DefaultButton>
<Modal
titleAriaId={"id"}
isOpen={isModalOpen}
onDismiss={hideModal}
isBlocking={true}
>
<div>
<span id={"id"}>Lorem Ipsum</span>
<IconButton
iconProps = {{iconName: 'Cancel'}}
ariaLabel="Close popup modal"
onClick={hideModal}
/>
</div>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas lorem nulla, malesuada ut sagittis sit
amet, vulputate in leo. Maecenas vulputate congue sapien eu tincidunt. Etiam eu sem turpis. Fusce tempor
</p>
</div>
</Modal>
</Fabric>
);
};
ReactDOM.render(app(), document.getElementById('app'))
<div id="app"></div>
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5f2d3a3e3c2b723b30321f6e69716e6b716f">[email protected]</a>/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@fluentui/react@7/dist/fluentui-react.js"></script>
<script src="https://unpkg.com/@uifabric/react-hooks@7/dist/react-hooks.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script defer type="text/babel" src="script.jsx"></script>
Any assistance would be greatly appreciated.