streamich / react-use

React Hooks — 👍
http://streamich.github.io/react-use
The Unlicense
41.66k stars 3.14k forks source link

What's the meaning of useSlider's prop 'styles' with the type CSSProperties #2508

Open rocketlyz opened 1 year ago

rocketlyz commented 1 year ago

What is the current behavior? I'm confused about the usage of styles prop in useSlider. Code at: https://github.com/streamich/react-use/blob/master/src/useSlider.ts#L16. src/useSlider.ts

//  type declared
export interface Options {
  ...
  styles: boolean | CSSProperties;
}

// only used as a judge

const styles = options.styles === undefined ? true : options.styles;

if (ref.current && styles) {
  ref.current.style.userSelect = 'none';
}

As shown in the above code, could anyone tell me why CSSProperties are used ?