react-pe
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

React PE

Progressive enhancement for React websites.

Example usage

// App.tsx
import React from 'react';
import { ProgressiveEnhancementProvider } from 'react-pe';

import Routes from './Routes';

function App() {
  return (
    <ProgressiveEnhancementProvider>
      <Routes />
    </ProgressiveEnhancementProvider>
  );
}

export default App;

// SomeRoute.tsx
import React from 'react';
import { ProgressivelyEnhance } from 'react-pe';

function SomeRoute() {
  return (
    <>
      <h1>SomeRoute</h1>
      <ProgressivelyEnhance enhancement={<WithJs />}>
        <WithoutJs />
      </ProgressivelyEnhance>
    </>
  );
}

function WithoutJs() {
  // HTML/CSS only component
}

function WithJs() {
  // Fancy JS component
}

export default SomeRoute;

See an example of upgrading to an interactive accordion by checking out the example folder.

Readme

Keywords

Package Sidebar

Install

npm i react-pe

Weekly Downloads

2

Version

0.1.0

License

none

Unpacked Size

5.09 kB

Total Files

4

Last publish

Collaborators

  • kenneth-gray