npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react.hiccup

v0.1.9

Published

Hiccup notation for React.js

Readme

React.hiccup

React 0% JSX, 100% hiccup

Dig React but JSX feels a bit weird? React.hiccup to the rescue!

React.hiccup is a complete replacement for JSX written in sweet.js.

React.hiccup uses a very clean, minimalistic notation - no HTML tags and no curly braces in HTML elements.

Syntax

React.hiccup syntax is heavily inspired by hiccup, a popular Clojure HTML rendering library.

In short, the syntax for a React.hiccup element is

hiccup [tag#id.class1.class2 {property1: value1, property2: value2} child1 child2 ...]

e.g.

hiccup [div#foo.bar.baz {some: "property", another: this.props.anothervalue} 
         [p "A child element"] "Child text"]

where the id, classes, property object and children are all optional. The className can be also specified among the properties, in this case it will be merged with the class names given after the tag.

A child can be a string, a number or a multiline string (use the backtick)

hiccup [div#foo.bar.baz `This
is a
  multiline 
  comment`]

A child can also be a JavaScript variable identifier

var comment = "Some comment";
hiccup [div#foo.bar.baz "The comment is: " comment]

but in case it is anything more complex, e.g. an expression, it needs to be surrounded by parentheses

hiccup [div#foo.bar.baz "The comment is: " (this.state.comment)]

or

var one_or_two = 1;
var comment1 = "First comment";
var comment2 = "Second comment";
hiccup [div#foo.bar.baz "The comment is: " (one_or_two == 1 ? comment1 : comment2 )]

Note that this is not required in the property object

var one_or_two = 1;
var comment1 = "First comment";
var comment2 = "Second comment";
hiccup [div#foo.bar.baz {someprop: 1 > 0 ? true : false, someother: "other" + "prop" } "A child"]

Shorthand react class declaration

React.hiccup also comes with an optional macro rclass for declaring a React class

rclass FooBar = {
  render: function() { ... }
}

expands to (omitting the sweet.js gensym)

var FooBar = React.createClass({
  render: function() { ... }
});

while

rclass window.FooBar = {
  render: function() { ... }
}

expands to

window.FooBar = React.createClass({
  render: function() { ... }
});

Get it

First install sweet.js if you don't have it already

$ npm install -g sweet.js

If you do have it, update it (0.4.0 is required)

$ npm update -g sweet.js

Then

$ npm install react.hiccup

All set. Now to compile a React.hiccup js file into a plain js file do

$ sjs -m react.hiccup/macros -o foo_build.js foo.js

To watch the file and have it automatically compiled whenever the file changes on disk

$ sjs -m react.hiccup/macros -o foo_build.js -w foo.js

Examples

React frontpage examples

Here's how React frontpage examples can be written using React.hiccup.

React tutorial

For something more involved you can take a look at the React tutorial.

Here's the code in JSX, and here's the same code in React.hiccup.

License

MIT license http://www.opensource.org/licenses/mit-license.php/

Copyright (C) 2014 Luca Antiga http://lantiga.github.io