All Projects → style-hook → style-hook

style-hook / style-hook

Licence: MIT license
use css in js with react hook.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to style-hook

useAudioPlayer
Custom React hook & context for controlling browser audio
Stars: ✭ 176 (+1000%)
Mutual labels:  react-hooks, react-hook
web
React hooks done right, for browser and SSR.
Stars: ✭ 940 (+5775%)
Mutual labels:  react-hooks, react-hook
react-hubspot
A collection of React hooks for interacting with Hubspot APIs
Stars: ✭ 20 (+25%)
Mutual labels:  react-hooks, react-hook
react-use-comlink
Three ways to use Comlink web workers through React Hooks (and in a typesafe manner).
Stars: ✭ 39 (+143.75%)
Mutual labels:  react-hooks, react-hook
veact
Mutable state enhancer library for React based on @vuejs
Stars: ✭ 62 (+287.5%)
Mutual labels:  react-hooks, react-hook
use-async-resource
A custom React hook for simple data fetching with React Suspense
Stars: ✭ 92 (+475%)
Mutual labels:  react-hooks, react-hook
Use Http
🐶 React hook for making isomorphic http requests
Stars: ✭ 2,066 (+12812.5%)
Mutual labels:  react-hooks, react-hook
use-algolia
Dead-simple React hook to make Algolia search queries. Supports pagination out of the box.
Stars: ✭ 29 (+81.25%)
Mutual labels:  react-hooks, react-hook
react-use-scroll-position
A react hook to use scroll position
Stars: ✭ 45 (+181.25%)
Mutual labels:  react-hooks, react-hook
usehooks-ts
React hook library, ready to use, written in Typescript.
Stars: ✭ 2,873 (+17856.25%)
Mutual labels:  react-hooks, react-hook
use-key-hook
React hook to handle all the key press.
Stars: ✭ 27 (+68.75%)
Mutual labels:  react-hooks, react-hook
react-hooks
🎣 React Hooks to get hooked on
Stars: ✭ 53 (+231.25%)
Mutual labels:  react-hooks, react-hook
use-state-machine
Use Finite State Machines with React Hooks
Stars: ✭ 28 (+75%)
Mutual labels:  react-hooks
forex-web-app
💱 foreign currency exchange app built with react hooks
Stars: ✭ 17 (+6.25%)
Mutual labels:  react-hooks
react-ssr-starter
🔥 ⚛️ A React boilerplate for a universal web app with a highly scalable, offline-first foundation and our focus on performance and best practices.
Stars: ✭ 40 (+150%)
Mutual labels:  react-hooks
react-with-threejs-example
An example project integrating React with three.js
Stars: ✭ 27 (+68.75%)
Mutual labels:  react-hooks
fireschema
Strongly typed Firestore framework for TypeScript
Stars: ✭ 193 (+1106.25%)
Mutual labels:  react-hooks
jsbb
JavaScript building blocks
Stars: ✭ 31 (+93.75%)
Mutual labels:  react-hooks
react-without-redux
React State Management without Redux
Stars: ✭ 33 (+106.25%)
Mutual labels:  react-hooks
fluent-windows
🌈 React components that inspired by Microsoft's Fluent Design System.
Stars: ✭ 122 (+662.5%)
Mutual labels:  react-hooks

logo

style-hook

easy to write dynamic css

Build Status codecov

features

  • use css in react hook
  • easy to get started

install

use npm

npm i -S style-hook

or use yarn

yarn add style-hook

minify css in js (recommend)

add babel plugin to your .babelrc

{
  "plugins": [
    "style-hook/babel"
  ]
}

usage

say hello world to get started

import React from 'react'
import { useStyle } from 'style-hook'
export default function() {
  const s = useStyle `
    font-size: 30px;
    margin: 20px;
    color: red;
  `
  return <div className={s}>hello world</div>
}

a dynamic style example

all grammars are js, one you need to learn is js.

import React from 'react'
import { css, useStyle } from 'style-hook'
function HelloWorld(props) {
  const cName = useStyle `
    font-size: 30px;
    width: ${100/3}%;
    margin: ${props.margin || 10}px;
    color: ${props.color};
    :hover {
      ${props.hoverStyle}
    }
  `
  return <div className={cName}>hello world</div>
}
export default () => {
  const hoverStyle = css `color: red;`
  return (
    <HelloWorld color="pink" hoverStyle={hoverStyle} />
  )
}

more usages

see the wiki: api and F&Q

typescript

support by default

Highlight and IntelliSense (recommend)

support me

if you like this project, star it, let more one know.

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].