Skip to content
Another one markup library for React.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status

Another one markup library for React.js inspired by hyperscript. It allows use valid JavaScript code instead of JSX, like this:

import {h} from 'react-markup'

        h("div.title", "People List")
    h("div.body", person => (
        h("div.person", {},
    h("div#footer.hidden", "(footer content)")

// which analogue in JSX is:
    <div id="header" className="highlighted hover">
        <div>People list</div>
    <div className="body">
   person => (
                <div className="person" key={}>{}</div>
    <div id="footer" className="hidden">(footer content)</div>


npm install --save react-markup


Facebook developers encourage everybody use JSX in React code. However, this approach has several disadvantages:

  • a lot of IDE's and text editors, which support JS syntax, work bad with JSX syntax

  • it could be harder to properly set up your build process to transpile from JSX and from ES6 at the same time

  • some people think, that mix of JS and JSX is harder to read


This library was inspired by different hyperscript-like libraries, including react-hyperscript and
virtual-hyperscript, but it has several advantages:

  • it is possible to pass child elements as array and as varargs, and semantic of these methods corresponds to React.createElements semantics (e. g. it requires to pass key property for children, passed as array);

  • it doesn't mutate properties (which is not true for react-hyperscript);

  • it faster than analogues.

More examples

Simple element:

// JSX
<div>Text content</div>

// react-markup
h('div', 'Text content')
// ...or
div('Text content')

Div with class and id

// JSX
<div className='highlighted' id='header'>
    Text content

// react-markup
    'Text content'

Passing children as varargs

// JSX
<div className='container'>

// react-markup
    h('div', 'Header'),
    h('div', 'Body'),

Passing children as array

// JSX
<div className='container'>
    { => (
            <div key={}>{x.title}<div>

// react-markup
h('div.container', => (
    h('div', {}, x.title)
You can’t perform that action at this time.