npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-apollo-notifications

v0.1.2

Published

Notification component that uses a GraphQL subscription query

Downloads

12

Readme

react-apollo-notifications

Notification component that takes a GraphQL subscription query

NPM Build Status JavaScript Style Guide

Install

npm install --save react-apollo-notifications

Usage

  • Clone apollo-subscription-server to set up an apollo server with subscriptions
  • npm install --save react-apollo-notifications to your react project
  • Calling Notifications
import React from 'react';
import DemoApp from "./DemoApp";

// GraphQL boilerplate imports
import gql from 'graphql-tag';
import { split } from 'apollo-link';
import { HttpLink } from 'apollo-link-http';
import { ApolloClient } from 'apollo-client';
import { ApolloProvider } from 'react-apollo';
import { WebSocketLink } from 'apollo-link-ws';
import { getMainDefinition } from 'apollo-utilities';
import { InMemoryCache } from 'apollo-cache-inmemory';

import { Notifications } from 'react-apollo-notifications';

const NS = gql`
  subscription {
    subscribeToNotifications{
      message
      date
    }
  }
`;

export default function App() {
  const uri = 'ws://localhost:4000/graphql';

  // Create an http link:
  const httpLink = new HttpLink({ uri });

  // Create a WebSocket link:
  const wsLink = new WebSocketLink({
    uri,
    options: {
      reconnect: true
    }
  });

  const link = split(
    ({ query }) => {
      const definition = getMainDefinition(query);
      return (
        definition.kind === 'OperationDefinition' &&
        definition.operation === 'subscription'
      );
    },
    wsLink,
    httpLink,
  );

  const cache = new InMemoryCache();
  const client = new ApolloClient({ link, cache });

  return (
    <ApolloProvider client={client}>
      <DemoApp />
      <Notifications 
        subscription={NS} 
        titleProperty='title' 
        messageProperty='message' 
      />
    </ApolloProvider>
  )

}

Notes

  • Click here for example
  • react-apollo-notifications makes use of react-notifications-component so the props are identical

Props Details

| Name | Type | Options | Default | | ------------- |:-------------:|:---------------|:---------:| | subscription (required) | any | gql(subscription_query) | none (required) | | titleProperty | string | (property on graphql query) | if not specified 'Alert' will be there| | messageProperty (required) | string | (property on graphql query) | | | duration | number |(in milliseconds) | 4000 | | notificationStyle | NotificationStyle | | | | notificationStyle.position | string | 'top-left' 'top-right', 'top-center', 'bottom-left','bottom-right' 'bottom-center' | 'top-right' | | NotificationStyle.type | string | 'success', 'danger', 'info', 'default', 'warning' | 'info' | | NotificationStyle.animationIn | string | Any animate.css class Options Here! | 'fadeInRight' | | NotificationStyle.animationOut | string | Any animate.css class Options Here! | 'fadeOut' |

Roadmap

  • Custom Component
  • More flexibility to default component
    • Onclick event
    • Custom background and text color

License

MIT © Dominic Crofoot