Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

teact

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teact - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

test/benchmarks/index.coffee

10

package.json
{
"name": "teact",
"version": "1.0.1",
"version": "1.0.2",
"description": "Generate React elements with CoffeeScript functions",
"homepage": "http://goodeggs.github.com/teact/",
"homepage": "http://github.com/hurrymaplelad/teact",
"license": "MIT",

@@ -10,3 +10,3 @@ "main": "lib/teact",

"type": "git",
"url": "git://github.com/goodeggs/teact.git"
"url": "git://github.com/hurrymaplelad/teact.git"
},

@@ -30,2 +30,3 @@ "keywords": [

"devDependencies": {
"benchmark": "^1.0.0",
"coffee-script": ">=1.8.0",

@@ -40,3 +41,4 @@ "expect.js": "^0.3.1",

"test": "mocha",
"compile": "coffee --compile --output lib/ src/"
"compile": "coffee --compile --output lib/ src/",
"benchmark": "coffee test/benchmarks"
},

@@ -43,0 +45,0 @@ "dependencies": {

51

README.md
# Teact
It's better than cjsx.
It's [better than cjsx](#how-is-this-better-than-cjsx).
Build React element trees by composing functions.
You get full javascript control flow, and minimal boilerplate.
It's also quite simple, just a thin wrapper around [React.createElement](https://facebook.github.io/react/docs/top-level-api.html#react.createelement) like JSX.
It's also quite simple, just a thin wrapper around [React.createElement](https://facebook.github.io/react/docs/top-level-api.html#react.createelement) like JSX, making [fast](#performance) and lightweight (2KB gzipped).

@@ -42,3 +42,3 @@ [![Build Status](http://img.shields.io/travis/hurrymaplelad/teact.svg?style=flat-square)](https://travis-ci.org/hurrymaplelad/teact)

render: ->
crel 'div', className: 'foo', ->
crel 'div', className: 'foo', =>
crel 'div', 'bar'

@@ -52,3 +52,3 @@ ```

crel 'div', className: 'foo', ->
crel 'div', 'bar'
crel 'div', props.bar
```

@@ -84,3 +84,3 @@

T.div 'div', className: 'foo', ->
T.div className: 'foo', ->
T.text 'Blah!'

@@ -94,15 +94,44 @@ ```

div 'div', '.foo', ->
div '.foo', ->
text 'Blah!'
```
Legacy
-------
## Performance
A [super-basic performance test](test/benchmarks/index.coffee) suggests that teact has no discernible impact on React rendering performance:
```sh
$ npm run benchmark
> native x 5,197 ops/sec ±3.30% (76 runs sampled)
> teact x 5,339 ops/sec ±2.23% (82 runs sampled)
> Fastest is teact,native
```
It's also lightweight, at 5KB minified, 2KB gzipped.
## How is this better than CJSX?
- Familiar control flow with branching and loops. See examples above.
- No transpiler to [maintain](https://github.com/jsdf/coffee-react/issues/28).
- No [extraneous enclosing tags](https://babeljs.io/repl/#?experimental=false&evaluate=true&loose=false&spec=false&code=%3Cdiv%3E%3C%2Fdiv%3E%0A%3Cdiv%3E%3C%2Fdiv%3E) required:
```coffee
renderHeader: ->
unless @props.signedIn
crel 'a', href: '...', 'Sign in'
crel 'h1', 'Tea Shop'
```
Just works.
- [Nice syntax errors](https://github.com/jsdf/coffee-react/issues/32).
- Half the lines of code. Those closing tags really add up.
Other folks have [reached similar conclusions](https://slack-files.com/T024L9M0Y-F02HP4JM3-80d714). They were later [bit by using the React API directly](https://github.com/planningcenter/react-patterns#jsx) when the implementation changed. A thin wrapper like Teact should minimize this risk.
## Legacy
[Markaby](http://github.com/markaby/markaby) begat [CoffeeKup](http://github.com/mauricemach/coffeekup) begat
[CoffeeCup](http://github.com/gradus/coffeecup) and [DryKup](http://github.com/mark-hahn/drykup) which begat
[Teacup](http://github.com/goodeggs/teacup) which begat **React**.
[Teacup](http://github.com/goodeggs/teacup) which begat **Teact**.
Contributing
-------------
## Contributing

@@ -109,0 +138,0 @@ ```sh

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc