Suppose I have these components in my project:
class MessageHeader extends React.Component { /* ... */ }
class NiceButton extends React.Component { /* ... */ }
class FridgeContents extends React.Component { /* ... */ }| const bypass = [ | |
| // function names to avoid logging | |
| ]; | |
| const collapsed = [ | |
| // function names to groupCollapsed | |
| ]; | |
| module.exports = function(babel) { | |
| const { types: t } = babel; | |
| const wrapFunctionBody = babel.template(`{ |
| function increment(props, state) { | |
| return { | |
| value: state.value + props.step, | |
| }; | |
| } | |
| function decrement(props, state) { | |
| return { | |
| value: state.value - props.step, | |
| }; |
| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
In React's terminology, there are five core types that are important to distinguish:
React Elements
Tool: Supergrep
| require 'active_record' | |
| require 'activerecord-import' | |
| require 'benchmark' | |
| require 'pg' | |
| include ActiveRecord | |
| Base.establish_connection adapter: 'postgresql', | |
| encoding: 'unicode', | |
| pool: 5, |
| A contents <<< | |
| send this to a | |
| this goes to a | |
| a, I forgot to add this | |
| <<< | |
| B contents <<< | |
| this goes to b | |
| b, please | |
| <<< |