@codeftw/future-web-ui-alert

Library Component React UI Alert

Usage no npm install needed!

<script type="module">
  import codeftwFutureWebUiAlert from 'https://cdn.skypack.dev/@codeftw/future-web-ui-alert';
</script>

README

UI Alert

npm version

Installation

npm install @codeftw/future-web-ui-alert

Usage

  • Add AlertProvider wrapping your App
import { AlertProvider } from '@codeftw/future-web-ui-alert';


  render(
    <ApolloProvider client={client}>
      <MuiThemeProvider theme={theme}>
        <TunnelProvider>
          <AlertProvider>
            <BrowserRouter>
              <AppContainer/>
            </BrowserRouter>
          </AlertProvider>
        </TunnelProvider>
      </MuiThemeProvider>
    </ApolloProvider>,
    document.getElementById('app')
  );
  • Add the Alert component somewhere in your App
import { Alert } from '@codeftw/future-web-ui-alert';

<Alert />
  • Use our HOC withAlert to have access to showAlert function
import { withAlert } from '@codeftw/future-web-ui-alert';

const AddTask = withAlert(({showAlert}) => {
   ...
   showAlert('Task added');
   ...
});