UNPKG

@onesy/style-react

Version:

Onesy CSS in JS styling solution for React

12 lines (11 loc) 533 B
import React from 'react'; import { classNames } from '@onesy/style'; import style from './style'; // May be TValue or a string as a string value literal const responses = {}; export default function className(value_, props_ = {}, className_ = '', options_ = {}) { if (!responses[options_.name]) responses[options_.name] = []; const useStyle = React.useState(() => style(value_, options_, responses[options_.name]))[0]; const values = useStyle(props_); return values.class && classNames([className_, values.class]) || ''; }