Giter VIP home page Giter VIP logo

react-opal's People

Contributors

gitter-badger avatar josephgrossberg avatar wied03 avatar zetachang avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lgp698asd

react-opal's Issues

Context

https://www.tildedave.com/2014/11/15/introduction-to-contexts-in-react-js.html

Could make this work w/ React.rb:

#Component factory:
optional_native_alias[:getChildContext, :get_child_context]

# and under ctor.DefaultProps=
ctor.contextTypes = #{klass.respond_to?(:get_context_types) ? klass.get_context_types : `{}`};
ctor.childContextTypes = #{klass.respond_to?(:get_child_context_types) ? klass.get_child_context_types : `{}`};

# Then:

module ReactTweaks
  module ChildContext
    def self.included(base)
      base.class_eval do
        class_attribute :context, :child_context
      end
      base.extend(ClassMethods)
    end

    def context_from_parent
            Hash.new(`#{self}.context`).inject({}) do |memo, (k, v)|
              memo[k.underscore] = v
              memo
            end
    end

    module ClassMethods
      def context_types(&block)
        self.context = block.call
      end

      def child_context_types(&block)
        self.child_context = block.call
      end

      def get_context_types
        self.context || `{}`
      end

      def get_child_context_types
        self.child_context || `{}`
      end
    end
  end
end

Optimization

https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html

React now supports two compiler optimizations that can be enabled in Babel 5.8.24 and newer. Both of these transforms should be enabled only in production (e.g., just before minifying your code) because although they improve runtime performance, they make warning messages more cryptic and skip important checks that happen in development mode, including propTypes.

Might want to change the method_missing behavior that deals with HTML element and create them this way (1 less function call)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.