Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
It's 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 like JSX.
{crel} = require 'teact'
crel 'div', '#root.container', ->
unless props.signedIn
crel 'button', onClick: handleOnClick, 'Sign In'
crel.text 'Welcome!'
Transforms into:
React.createElement('div',
{id: root, className: 'container'}, [
(props.signedIn ? React.createElement('button',
{onClick: handleOnClick}, 'Sign In'
) : null)
'Welcome!'
]
)
Use it from your component's render method:
{Component} = require 'react'
{crel} = require 'teact'
class Widget extends Component
render: ->
crel 'div', className: 'foo', ->
crel 'div', 'bar'
Or in a stateless component:
module.exports = (props) ->
crel 'div', className: 'foo', ->
crel 'div', 'bar'
crel
is just a thin wrapper around React.createElement,
so you can pass it components instead of crel names:
class DooDad extends Component
render: ->
crel 'div', className: 'doodad', =>
crel 'span', @props.children
class Widget extends Component
handleFiddle: =>
# ...
render: ->
crel 'div', className: 'foo', =>
crel DooDad, onFiddled: @handleFiddle, =>
crel 'div', "I'm passed to DooDad.props.children"
Teact exports bound functions for elements, giving you options for terser syntax if you're into that:
T = require 'teact'
T.div 'div', className: 'foo', ->
T.text 'Blah!'
or the Teacup / CoffeeCup signatures:
{div, text} = require 'teact'
div 'div', '.foo', ->
text 'Blah!'
Markaby begat CoffeeKup begat CoffeeCup and DryKup which begat Teacup which begat React.
$ git clone https://github.com/hurrymaplad/teact && cd teact
$ npm install
$ npm test
FAQs
Generate React elements with CoffeeScript functions
The npm package teact receives a total of 47 weekly downloads. As such, teact popularity was classified as not popular.
We found that teact demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.