Permalink
a2e8a8b Mar 3, 2018
1 contributor

Users who have contributed to this file

21 lines (12 sloc) 575 Bytes

<ClassNames>

Side-effect component that when mounted sets class names on a given DOM element and removes them, when it is being unmounted.

Usage

import {ClassNames} from 'libreact/lib/ClassNames';

<ClassNames list={['some-class', 'another-class']} />

Props

  • list — required, array of string, list of class names to set.
  • el — optional, DOM element on which to set the class names, defaults to document.body.
  • persist — optional, boolean, whether to keep the class names when component un-mounts, defaults to false.