0.2.10 • Published 4 years ago

@react-ee/layout v0.2.10

Weekly downloads
17
License
UNLICENSED
Repository
github
Last release
4 years ago

@react-ee/layout

Provides Context which allows to show messages and loading indicator.

Installation

yarn add @react-ee/layout @material-ui/core @material-ui/icons react react-dom

Usage example

Wrap your app with Layout:

import { Layout } from '@react-ee/layout';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
  <Layout>
    <App />
  </Layout>,
  document.getElementById('root')
);

useLayout somewhere inside your app:

import useLayout from '@react-ee/layout';
import React, { useEffect } from 'react';

export default () => {
  const { incrementLoading, showSnackbar } = useLayout();
  useEffect(() => {
    incrementLoading();
    showSnackbar('WOW', 'success');
  }, [incrementLoading, showSnackbar]);
  return <>foo</>;
};

Common pitfalls

When invoking function acquired from useLayout takes no effect, you forgotten to wrap your app with <Layout />.

Treat <Layout /> as React Context and useLayout as useContext(Layout)

0.2.10

4 years ago

0.2.5

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.1.9

4 years ago

0.1.7

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago