Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ReactとRxで負債作った

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 ReactとRxで負債作った

ReactとRxでだめなことやっちゃったやつです

More Decks by Taketoshi Aono(青野健利 a.k.a brn)

Other Decks in Programming

Transcript

  1. class Component extends React.Component {! render() {! return (! <div>!

    <h1>{title}</h1>! <Subscriber>! <span className={classNameObservable}>! {contentObservable}! </span>! </Subscriber>! </div>! )! }! }!
  2. import {Tags as T} from './subscriber';! ! class Component extends

    React.Component {! render() {! return (! <div>! <h1>{title}</h1>! <T.Span className={classNameObservable}>! {contentObservable}! </T.Span>! </div>! )! }! }!
  3. class Subscriber extends React.Component {! constructor(p) {! super(p);! this.state =

    { vdom: null };! }! ! render() { return this.state.vdom }! ! componentDidMount() {! this.searchAndSubscribeObservables();! }! }!
  4. const foundObservables = [];! ! React.Children.map(element.children, (child) => {! if

    (child instanceof Observable) {! foundObservables.push(! {! update: value => updateChild(element, value),! observable: child! });! } else {! this.checkProps(child);! }! });!