UNPKG

react-session-api

Version:

Store the data throughout the session and move the data between components. You can easily move state between components.

20 lines (16 loc) 405 B
import React from 'react'; import Session from '../../src' const DecreaseButton = () => { const onDecrease = () => { let counter = Session.get("counter") - 1; Session.set("counter", counter); } return ( <button className="btn btn-sm btn-danger" onClick={(e) => onDecrease()}> Decrease Number </button> ) } export default DecreaseButton;