Skip to content

Commit 62efeec

Browse files
committed
docs(readme): update Readme
1 parent c9205a6 commit 62efeec

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
# CSS Variables React hook
88

9-
[css-vars-hook](https://github.com/morewings/css-vars-hook) contains React hooks to set and manipulate CSS custom properties from React component.
9+
[css-vars-hook](https://github.com/morewings/css-vars-hook) contains React hooks to set and manipulate CSS custom properties (variables) from React component within React components.
10+
1011

1112
[Demo](https://morewings.github.io/css-vars-hook/)
1213

1314
[dev.to article](https://dev.to/morewings/how-to-use-css-vars-hook-to-manipulate-css-custom-properties-in-react-38dg)
1415

15-
## Features
16+
## Highlights
1617

17-
- Set, modify and delete [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) inside React components.
18-
- Set up and manage CSS themes for the whole application.
19-
- Apply CSS themes (multiple variables) to any HTMLElement.
20-
- Written in Typescript.
21-
- Zero dependencies.
22-
- Small and fast.
18+
- **CSS Variables in React**: manage your component design in a fast and convenient way.
19+
- **Dynamic Theming**: create and manage themes for your application. Apply multiple CSS variables to any HTML element.
20+
- **TypeScript Support**: The library is written in TypeScript, offering type safety and enhancing developer experience.
21+
- **Zero Dependencies**: It operates independently without the need for additional libraries, ensuring a lightweight integration.
22+
- **Performance**: The hook is optimized for performance, with a small footprint that does not impact application speed.
2323

2424
## Install
2525

@@ -29,7 +29,7 @@ npm install css-vars-hook
2929

3030
## Usage
3131

32-
`css-vars-hook` exposes two hooks: `useRootTheme`, `useLocalTheme`.
32+
`css-vars-hook` exposes two hooks: `useRootTheme`, `useLocalTheme`. Both of them provide developer a bridge between **React Component state** and **CSS Custom Properties**.
3333

3434
## `useRootTheme`
3535

@@ -62,7 +62,7 @@ export const App = () => (
6262

6363
### Memoize theme
6464

65-
To avoid unnecessary reconciliations and re-renders theme object has to **preserve referential equality** during component lifecycle.
65+
To avoid unnecessary reconciliations and re-renders theme object has to **preserve referential equality** during component lifecycle.
6666

6767
```tsx
6868
// Wrong!!! Component will rerender every time
@@ -72,7 +72,7 @@ const ComponentA: FC = () => {
7272
foo: 'bar'
7373
}
7474

75-
return <RootThemeProvider theme={theme}>{/*...*/}</RootThemeProvider>
75+
return <RootThemeProvider theme={theme}>{/*...*/}</RootThemeProvider>
7676
}
7777

7878
// Wrong!!! Component will rerender every time
@@ -84,9 +84,9 @@ const ComponentB: FC = () => {
8484
// Correct!!! Theme will preserve untill one of its' properties change
8585

8686
const ComponentC: FC<{foo: string}> = ({foo}) => {
87-
87+
8888
const theme = useMemo(() => ({foo}), [foo])
89-
89+
9090
return <RootThemeProvider theme={theme}>{/*...*/}</RootThemeProvider>
9191
}
9292

@@ -235,9 +235,9 @@ const Component = () => {
235235
setTheme({boxColor: 'darkYellow'})
236236
}, [])
237237
return (
238-
<Button
239-
theme={theme}
240-
as="button"
238+
<Button
239+
theme={theme}
240+
as="button"
241241
onClick={setDarkMode}>
242242
Set dark mode
243243
</Button>

0 commit comments

Comments
 (0)