Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saber2pr/tsx
a tsx renderer for the browser and node.js
https://github.com/saber2pr/tsx
jsx react tsx
Last synced: 7 days ago
JSON representation
a tsx renderer for the browser and node.js
- Host: GitHub
- URL: https://github.com/saber2pr/tsx
- Owner: Saber2pr
- Created: 2019-06-15T15:10:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T12:01:57.000Z (over 4 years ago)
- Last Synced: 2024-11-09T00:34:36.525Z (2 months ago)
- Topics: jsx, react, tsx
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @saber2pr/tsx
> a tsx renderer for the browser and node.js
> 纯粹的视图层
```bash
# from npm
npm install @saber2pr/tsx# from github
git clone https://github.com/Saber2pr/tsx.git
```# Examples
## in browser.
```tsx
import TSX, { renderDOM } from '@saber2pr/tsx'function HelloMessage({ name }) {
returnHello {name}
}// render to dom.
document
.getElementById('root')
.append(renderDOM())
```## in node.js
```tsx
import TSX, { renderString, Style } from '@saber2pr/tsx'function Page({ name }) {
return (
{{
'.myTsx': { color: 'blue' }
}}
{name}
myTsx
)
}// render to string.
console.log(renderString())
```# tsx
1. tsx map
2. tsx render children> and more feature supported.
# tsconfig
ensure:
```json
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "TSX"
}
}
```---
## start
```bash
npm install
``````bash
npm startnpm run dev
```
> Author: saber2pr
---
## develope and test
> you should write ts in /src
> you should make test in /src/test
> export your core in /src/index.ts!