andywer / andywer/ideabox

ReactCSSDOM

オープン
#15 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
1
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

Extend `react-dom` to provide a generic, fully featured, declarative styling API that is as easy to use as inline styles, but comes with the power of CSS classes:

```jsx
import React from 'react'

const MyButton = ({ children, primary }) => {
return (
{children}
)
}
export default MyButton
```

To render your app:

```jsx
import * as ReactCSSDOM from 'react-css-dom' // instead of react-dom
import MyButton from './Button'

ReactCSSDOM.render(
Click me,
document.getElementById('demo')
)
```

Server-side rendering should also be really simple. Something like that:

```jsx
import * as ReactCSSDOM from 'react-css-dom' // instead of react-dom
import MyButton from './Button'

const stylesheet = ReactCSSDOM.createStylesheet()
const rendered = ReactCSSDOM.renderToString(Click me, stylesheet)

const html = `


${stylesheet.toStyleTag()}


${rendered}

`
```

## Benefits

- Great for component libraries, since it requires no dependencies to be added to the library
- Thus helps keeping the bundle small
- Dead-simple to set up, even for SSR
- Generic, universal styling API

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。