Blame view

天文台pc/tianwentai-ui/node_modules/react-style-singleton/README.md 866 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  react-style-singleton
  ====
  
  __300b__ with all dependencies, minified and gzipped
  
  
  Creates a style component with internal _tracker_.
  - Adds styles to the browser on the __first__ instance mount.
  - Removes after the __last__ instance unmount.
  - Thus helps you deliver styles you need to the customer, and clean up later.
  - Is not server-side rendering compatible!
  
  
  # API
  
  ## Component
  
  ```js
  import {styleSingleton} from 'react-style-singleton'
  
  const Style = styleSingleton();
  
  export const App = () => (
    <Style styles={'body {color:red}'} />
  );
  ```
  
  ## Hook
  
  ```js
  import {styleHookSingleton} from 'react-style-singleton';
  
  const useStyle = styleHookSingleton();
  const useAnotherStyle = styleHookSingleton();
  
  export const App = () => {
    useStyle('div {color:red}');
    useAnotherStyle('body { background-color:red }');
    return (<div />);
  }
  ```
  
  # License
  
  MIT