New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rescript-use-dark-mode

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rescript-use-dark-mode

ReScript bindings for use-dark-mode

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

rescript-use-dark-mode

ReScript bindings for use-dark-mode

Installation

Install package:

$ yarn add rescript-use-dark-mode
// OR 
$ npm i rescript-use-dark-mode

Then add rescript-use-dark-mode to your bsconfig.json's bs-dependencies

{
  "bs-dependencies": [
    "@rescript/react",
+   "rescript-use-dark-mode"
  ],
}

Usage

let darkMode = DarkMode.use(. None, None);

// or with default value
let darkMode = DarkMode.use(. Some(false), None);

// or with default value and config
let config: DarkMode.config = {
  classNameDark: Some("dark"),
  classNameLight: Some("light"),
  // and so on
}
let darkMode = DarkMode.use(. Some(false), Some(config));


// in react component
let onClick= (_: ReactEvent.Mouse.t) => {
  darkMode.toggle();
}

let currentTheme = switch darkMode.value {
  | true => React.string(`dark`)
  | false => React.string(`light`)
}

<Button onClick>currentTheme</Button>

Keywords

rescript

FAQs

Package last updated on 04 Feb 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