title: How do i dynamically import a function in nextjs typescript?
body: <p>I am using a react modal library called react-st-modal, and I'm trying to import a hook called useDialog. My code doesnt work and looks like this:</p>
  <pre><code>const Dialog = dynamic&lt;Function&gt;(
    import(&quot;react-st-modal&quot;).then(module =&gt; module.useDialog) as any)
  </code></pre>
  <p><code>Dialog</code> is a type, and cannot be used as a function. what can i do</p>