[SOLVED] How to create a Dialog inside a Functional Component in ReactJS

How can i create a Dialog inside a Functional Component in ReactJS?

F7 extensions are not available in functional components. So to access f7 instance you need to save it somewhere for example as global var. In your main App component:

componentDidMount() {
  this.$f7ready((f7) => {
    window.f7 = f7;
  })
}

Then you can access it as window.f7.dialog

1 Like

Will this change in future versions? Since React slowly steps back from class components.

BTW, love your Project and really appreciate the Hard work you put into it.

Yes, in v5 it will be possible to just:

import { f7 } from 'framework7-react';

to get the instance

3 Likes