Skip to content

Compared to ReactJS

Kent 'picat' Gruber edited this page Dec 3, 2017 · 1 revision

Compared to ReactJS

Another JavaScript library that builds user interfaces you may be familiar with is ReactJS. This is a simple example using ReactJS compared directly to BuilderJS.

ReactJS Example

class HelloMessage extends React.Component {
  render() {
    return (
      <div>
        Hello {this.props.name}
      </div>
    );
  }
}

ReactDOM.render(
  <HelloMessage name="World" />,
  mountNode
);

BuilderJS Example

var b = new Builder()

var helloMessage = b.component(
  function(options) {
    return b.div({ text: "Hello " + options.name})
  }
)

b.append(helloMessage({ name: "World" }, { to: mountNode }))

⚠️ In case you're worrying, this is obviously not a full comparison of the abilities of both libraries!

Clone this wiki locally