New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-life-game

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-life-game

A React component that renders "Conway's Game of Life".

  • 1.1.1
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

React life game

A React component that renders "Conway's Game of Life".

lifegame

Installation

npm:

$ npm install react-life-game

yarn:

$ yarn add react-life-game

Usage

import { LifeGameField } from 'react-life-game';

function App() {
  return (
    <LifeGameField
      option={
        {
          /* option here */
        }
      }
    />
  );
}

Playground

CodeSandBox

option

optiontypedescriptiondefault
initialAliveRationumberRatio of living cells in the initial state ([0,1])0.12
intervalnumberTime per each generation ([ms])1000
aliveColorstringColor of living cells ( can be any color that "css" can accept. i.e. blue, #1e3a8a, ... )#1e3a8a
deadColorstringColor of dead cells ( can be any color that "css" can accept. i.e. blue, #1e3a8a, ... )#0f172b
cellSizenumberSize of cell ([px])12
widthnumberWidth of the field of game of lifewindow.innerWidth
heightnumerHeight of the field of game of lifewindow.innerHeight

tips

Re-render on window resize

By default, this component is not resizable. To support window resize, you need to use key prop for this component generated by useKeyOnResize hook.

import { LifeGameField, useKeyOnResize } from 'react-life-game';

function App() {
  const { key } = useKeyOnResize();
  return <LifeGameField key={key} option={{...}} />;
}

FAQs

Package last updated on 31 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc