Framework7 React Package Structure
Package
Framework7 React package contains the following files and folders:
framework7-react/
components/
accordion-content.js
accordion-item.js
accordion-toggle.js
accordion.js
actions-button.js
actions-group.js
actions-label.js
actions.js
app.js
...
framework7-react.bundle.js
framework7-react.bundle.min.js
framework7-react.esm.js
Browser Script (UMD)
framework7-react.bundle.js
is so called UMD-format JavaScript intended to be used directly in browser (e.g. with <script src="...">
) or with libraries like Require.js. It already contains all Framework7-React components registered.
It is not recommended to use this version for production, just for development and testing.
Components
All React components are located in components/
folder. These components are ES modules.
import App from 'framework7-react/components/app.js';
import Navbar from 'framework7-react/components/navbar.js';
Or they can be imported using named import from main file
import { App, Navbar } from 'framework7-react';
ES Module
Framework7 React plugin can be imported as an ES-next module:
// Import Framework7 Core
import Framework7 from 'framework7';
/*
Or import bundle with all components:
import Framework7 from 'framework7/framework7.esm.bundle.js';
*/
// Import Framework7 React
import Framework7React from 'framework7-react';
// Init plugin
Framework7.use(Framework7React)
By default it exports only Framework7-React plugin without any components. To import components separately, we need to use named import:
import { App, Navbar } from 'framework7-react';
ES-Next
Note, that Framework7 and Framework7-React ES modules are in ES-next syntax, so don't forget to enable/configure your Babel/Buble to transpile them as well, as well as template7
, dom7
and ssr-window
modules that used as dependencies.