Skip to content

Instantly share code, notes, and snippets.

@MaximeHeckel
MaximeHeckel / findByType.js
Last active August 17, 2018 20:02
Medium - React "sub-components" - findByType function
import React from 'react';
const findByType = (children, component) => {
const result = [];
/* This is the array of result since Article can have multiple times the same sub-component */
const type = [component.displayName] || [component.name];
/* We can store the actual name of the component through the displayName or name property of our sub-component */
React.Children.forEach(children, child => {
const childType =
child && child.type && (child.type.displayName || child.type.name);
if (type.includes(childType)) {
@MaximeHeckel
MaximeHeckel / MyArticleView.js
Last active February 1, 2018 18:33
Medium - React "sub-components' - Article example 2
class MyArticleView extends React.Component {
...
render() {
return (
<Article>
<Article.Title>{this.renderTitle()}</Article.Title>
<Article.Subtitle>{this.renderSubtitle()}</Article.Subtitle>
<Article.Metadata>
{this.renderAuthor()}
{this.renderDate()}
@MaximeHeckel
MaximeHeckel / MyArticleView.js
Last active February 1, 2018 18:32
Medium - React “sub-components” - Article example 1
class MyArticleView extends React.Component {
...
render() {
return (
<div className={css.mainContainer}>
<div className={css.wrapper}>
<div className={css.titleContainer}>
<div className={css.title}>
<span>{this.renderTitle()}</span>
</div>
@MaximeHeckel
MaximeHeckel / weave(1.0.1).log
Last active September 15, 2015 10:28
Compatibility issue between weave router 1.1.0 <-> 1.0.1 ?
weave 2015/09/15 10:19:25.527177 ->[146.185.184.37:37684] connection accepted
weave 2015/09/15 10:19:25.528452 ->[146.185.184.37:37684|92:27:c5:47:c9:ce(5cd122c9-maximeheckel.node.tutum.io)]: completed handshake; using protocol version 1
weave 2015/09/15 10:19:25.530319 ->[146.185.184.37:37684|92:27:c5:47:c9:ce(5cd122c9-maximeheckel.node.tutum.io)]: connection added (new peer)
weave 2015/09/15 10:19:25.538672 ->[146.185.184.37:37684|92:27:c5:47:c9:ce(5cd122c9-maximeheckel.node.tutum.io)]: connection shutting down due to error: write tcp4 146.185.184.37:37684: connection reset by peer
weave 2015/09/15 10:19:25.539532 ->[146.185.184.37:37684|92:27:c5:47:c9:ce(5cd122c9-maximeheckel.node.tutum.io)]: connection deleted
weave 2015/09/15 10:19:25.540407 ->[146.185.184.37:37685] connection accepted
weave 2015/09/15 10:19:25.547399 ->[146.185.184.37:37685|92:27:c5:47:c9:ce(5cd122c9-maximeheckel.node.tutum.io)]: completed handshake; using protocol version 1
weave 2015/09/15 10:19:25.547595 ->[146.185.184.37:37685|92:27

Keybase proof

I hereby claim:

  • I am maximeheckel on github.
  • I am maximeheckel (https://keybase.io/maximeheckel) on keybase.
  • I have a public key whose fingerprint is DEE3 414A B70A 0CBE 6439 93C3 994B 2A42 CCF6 3249

To claim this, I am signing this object: