Skip to content

Instantly share code, notes, and snippets.

View renatorib's full-sized avatar

Renato Ribeiro renatorib

View GitHub Profile
@renatorib
renatorib / .gitignore
Created August 29, 2018 01:38
extract github followers
outputs/*
config.js
@renatorib
renatorib / OnlyInClient.jsx
Last active May 31, 2018 19:02
SSR - Render Only In Client
class OnlyInClient extends Component {
static defaultProps = { fallback: null }
state = { client: false }
componentDidMount() {
this.setState({ client: true })
}
render() {
if (!this.state.client) {
@renatorib
renatorib / dan-abramov-QA.md
Last active April 11, 2018 22:02
Dan Abramov Q/A at React Brasil Slack (2018/04/11 - 18:00 GMT)

Dan, there are bigger plans to redux this year?

Not sure what you mean 🙂 But I have no plans regarding Redux personally. I'm not actively involved with maintaining it.


Andrew Clark said on his Twitter that class components will be considered as legacy APIs in the future, while function components will remain. We must take this statement in consideration in the projects that are under development/will be developed? And what is the best way to write a component?

He also said on Twitter that we have dozens of thousands of class components and they aren't going anywhere 🙂 When/if we have a more convenient and less verbose way to declare components than classes, we'll definitely announce it, but I don't see how it could affect existing projects.

@renatorib
renatorib / modal.jsx
Last active April 3, 2018 22:29
different ways to use two render props in one component
// passing object to render with two fns (opener & content, for example)
<Modal>
{{
opener: ({ open }) => <button onClick={open}>Open Modal</button>,
content: {{ close }) => <div><h2>Hi modal</h2> <button onClick={close}>Close me</button></div>
}}
</Modal>
// passing as children array
// https://stackblitz.com/edit/react-array-render-props
@renatorib
renatorib / drafts.md
Last active January 9, 2018 19:23
1.0 Powerplug drafts

Drafts


Mouse

or MousePos, or MouseTrack, idk what is best name yet

Mouse is binded in a element, and your ratio values are relative to this element.

IDEAL API
class ToggleOpened extends Component {
state = { opened: false }
toggle = () =>
this.setState(state => ({ opened: !state.opened }))
render() {
return this.props.render({
opened: this.state.opened,
toggle: this.toggle,
<WhatIsTheMeaningOfLife
context={someInput}
render={meaningOfLife => (
<MyBeautifulUI>
{meaningOfLife}
</MyBeautifulUI>
)}
/>
@renatorib
renatorib / react-bps-example.jsx
Last active September 25, 2017 22:17
React BPS Example
const breakpoints = {
900: { name: 'Tablet' },
600: { name: 'Mobile' },
}
render(
<Hello name="Desktop" bps={breakpoints} />,
document.getElementById('root')
)
@renatorib
renatorib / links.md
Last active July 19, 2017 05:17
React Router 4
@renatorib
renatorib / repos.md
Last active May 3, 2017 16:20
React Animation & Transition

Labels

  • I.D: Implementation Difficulty: 0 to 10 where 0 is super easy and 10 is super hard.
Name Stars I.D. Links Type
react-motion 8,738 ⭐ 8 Github Generic
react-flip-move 1,341 ⭐ 0 Github - Example List