• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A little module for using React with Bacon.js

This project is no longer maintained

It probably still works, but maybe not for long with the latest versions of React and/or Bacon.js. It's not a lot of code, so I encourage you to fork the project and turn it into exactly what you need.

If you'd like to take over maintenance of this project, feel free to get in touch either over twitter or by opening an issue.

react-bacon

A little module for using React with Bacon.js.

Here's a JSFiddle!

Installation

For browserify projects, npm install --save react-bacon.

For other projects, use the UMD distribution in /dist/react-bacon.js.

If you are just putting it in a <script> tag, the library will be at window.ReactBacon.

Usage

Right now the library includes a single React mixin, BaconMixin.

BaconMixin provides a few different methods for your components:

component.propsProperty([propName])

Returns a memoized Bacon.Property backed by the component's props, skipping duplicate values. When a propName is present, the values of the property are those of the given prop. If no propName is given, the property's values are the whole props objects of the component.

The properties returned are cleaned up with a Bacon.End when the component unmounts.

component.stateProperty([stateName])

Like propsProperty(propName), but for state values.

component.eventStream(functionName)

Registers an event handler function on the component with the given name, which simply sends its argument to the returned Bacon stream.

The stream is memoized by the functionName, and gets cleaned up with a Bacon.End when the component unmounts.

component.plug(observable, [stateKey])

Plugs a Bacon observable into the component's state, and returns an unsubscribe function. If a stateKey is given, then values from the observable are assigned to the given key. If no stateKey is given, the values must be objects which are passed directly to setState to assign multiple state keys at once.

The component will unsubscribe from the stream when it unmounts.

Packaging

browserify --standalone ReactBacon src/react-bacon.js -o dist/react-bacon.js

More Repositories

1

zelkova

Elm-style FRP for Clojure and ClojureScript
Clojure
403
star
2

elm-graphql

A GraphQL library for Elm
Elm
313
star
3

cljs-promises

A ClojureScript library for using JS promises with core.async
Clojure
90
star
4

elm-composition-trees

A story about composing trees of computation
Elm
41
star
5

http_spy

Watch HTTP requests as they happen
Elixir
18
star
6

shopify-clj

A Clojure library for interacting with the Shopify API
Clojure
14
star
7

poker-hands

A little library to score poker hands in Clojure
Clojure
12
star
8

elm-json-bidirectional

Helps you construct two-way JSON encoder-decoders in Elm.
Elm
10
star
9

graphqlbin

Mock GraphQL schema server
TypeScript
9
star
10

ruler

Elixir
8
star
11

kozu

Promise-agnostic functional composition in JavaScript.
JavaScript
7
star
12

sprockets_rails3_backport

Backport of Rails 3.1.x Sprockets integration to Rails 3.0.x
Ruby
6
star
13

backfire

backpack => campfire bridge
Ruby
6
star
14

redoc-autogen

Automatically build docs for ReasonML packages
Dockerfile
5
star
15

zelkova-todomvc

TodoMVC with Zelkova and Reagent, translated from evancz/elm-todomvc
Clojure
4
star
16

elm-gif-lab

A little sandbox for making animated GIFs with Elm
Elm
4
star
17

glitch-elm-example

The glitch.com example project ported to Elm!
Elm
3
star
18

zelkova-quil-flyer

A little demo using Zelkova and Quil
Clojure
3
star
19

zelkova-om-searcher

A little demo using Zelkova and Om
Clojure
3
star
20

rule-of-thirds

evaluates objects from peekaboom data for their adherence to the rule of thirds
Python
3
star
21

elm-protocol-records

A library of Elm type protocols, implemented as extensible records
Elm
3
star
22

office-party

iTunes web UI built with Rails & Shoes
Ruby
2
star
23

old-office-party

Awesome jukeboxing for shared spaces.
Ruby
2
star
24

elm-secd

An implementation of Peter Landin's SECD machine in Elm
Elm
2
star
25

batman_workshop

Ruby
1
star
26

mephisto_export

Plugin which adds a couple of rake tasks for managing exports of Mephisto data.
Ruby
1
star
27

bin

~/bin
Ruby
1
star
28

async-tools

Tools for core.async
Clojure
1
star
29

quantified

Small library for working with units of measurement
Ruby
1
star
30

rust-secd

An implementation of Peter Landin's SECD machine in Rust
Rust
1
star
31

gh-pull-notifier

CoffeeScript
1
star
32

comp4106

AI programming
Ruby
1
star
33

tagflow

Instagram hashtag slideshows
JavaScript
1
star
34

channel

An incomplete implementation of CSP channels in Elixir
Elixir
1
star