-
Notifications
You must be signed in to change notification settings - Fork 0
Components
Aniket Prajapati edited this page Oct 15, 2020
·
6 revisions
FireJSX exports the following components for faster and easy to make webpages
-
Link: Use to navigate pages (in-project only). Preloads page content
onMouseEnter
event. Treat it as a normal anchor tag. -
Head: Injects children to head element. A wrapper around react-helmet. Allows SSR.
-
LazyLoad Enables lazy loading and SSR of components.
-
Loader Show progress bar on page load and Link
Make a page coms
in your pages dir.
Note you need to restart FireJSX to let the new page take effect
coms.jsx
import Wrap from "firejsx/Wrap";
import {hot} from "firejsx/Hot";
import Head from "firejsx/Head";
import Loader from "firejsx/Loader";
import Link from "firejsx/Link";
Wrap(() => {
return (
<div>
<Head>
<title>Index Page</title>
</Head>
<Loader effect={React.useEffect} delay={2000}>
<span style={{color:"blue"}}>Loading text with 2s delay</span>
{/*use Loader on page root, delay is optional*/}
</Loader>
<br/><br/>
<Link href="/index">Link to Index Page</Link>
</div>
)
},hot)
In the above example, we've implemented Head
, Loader
, and Link
components.
Note that page links always start with a '/'
We've described lazy loading in detail here
Star us on github or checkout our npmjs page.