@owsas/pubnub-react-counter
v1.0.3
Published
A channel occupancy counter for React
Downloads
7
Maintainers
Readme
pubnub-react-counter
Count how many people are present in one pubnub channel with React.
Demo
Usage
import React from 'react';
import { render } from 'react-dom';
import PubNub from 'pubnub';
import Index from '../src/index';
const pubnub = new PubNub({
publishKey: 'demo',
subscribeKey: 'demo',
ssl: true,
});
render(<p><Index channel="test-channel" pubnub={pubnub} /> visitor(s)</p>, document.getElementById('root'));
Dev Mode
- Clone this repository
- Run
yarn install
(Usage of Yarn is recommended) - Edit the
src/index.jsx
file and then runnpm run dev
. - This will start the
webpack-dev-server
- Then open your browser at
localhost:3200
- The browser will be updated everytime you change the code at
src/index.jsx
Dev Features
- Linting with eslint
- Linting code style: Airbnb
- Testing with
jest@^21.2.1
andenzyme@^3.1.1
- Uses
babel
for JS transpiling - Uses
webpack
for building the code
Folder structure
/src
: The module code/test
: The tests for thesrc
components/build
: The target compilation directory
Credits
Juan Camilo Guarín Peñaranda
Otherwise SAS
Cali, Colombia, 2017
License
MIT