Giter VIP home page Giter VIP logo

react-dream's People

Contributors

dependabot[bot] avatar xaviervia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-dream's Issues

Solve what to do with `combinators`

Right now to compose the React Dream objects the best way is through higher-order components and using .ap. To make using that smoother the higher-order component combinators need to be easily available in some way.

I thought about adding some .parent and .children functions that wrap common patterns to ReactDream itself, but I’m not yet completely sold on what the default semantics for splitting the props between the elements should be, so I don’t want to commit to any specific approach.

My best idea so far is so in some way expose the combinators already created in https://github.com/xaviervia/playing-react-fantasy-land-types/blob/master/src/helpers/combinators.js and add some other more.

Implement Monoid

The reason it has not been implemented yet is that the semantics of .concat are somewhat insatisfactory.

  1. Concat with the Empty object needs a hack to avoid putting an element called Empty side by side with it.
  2. Spreading props equally in both siblings is a strange behavior, rather unexpected.

Add .log(what : String) and .debug()

.log()

Maps with:

import React from 'react'
import { getDisplayName, setDisplayName } from 'recompose'

export default toLog => Target =>
  setDisplayName(getDisplayName(Target))(props => {
    const displayName = getDisplayName(Target)
    const args = [...(toLog ? [toLog, displayName] : [displayName]), props]
    console.log(...args)

    return <Target {...props} />
  })

.debug()

Maps with

import React from 'react'
import { getDisplayName, setDisplayName } from 'recompose'

export default Target =>
  setDisplayName(getDisplayName(Target))(props => {
    debugger

    return <Target {...props} />
  })

Algebras improvements

  • Monoid: Using Fragment it should be implementable. Caveats in #4 still apply but are ignorable.
  • Profunctor: Current implementation does not follow the laws, since map is implemented as-if ReactDream is the identity functor. To properly implement it, we need to introduce a map2 that composes on the React Element output instead of the React Component, then promap will follow the laws.

Write helpers for `transform`

It can be pretty useful to be able to set the transform style property with a shorthand:

Path.transform('rotate(180deg)')

Add .pickProps helper

Header.pickProps('title', 'tagline')

…would be equivalent to

Header.contramap(({title, tagline}) => ({title, tagline}))

Define the .siblingAfter, .siblingBefore, .child and .parent helpers

From the higher-order components:

const withChildren = getChildProps => Parent => Child => props =>
  <Parent {...props}>
    <Child {...getChildProps(props)} />
  </Parent>

const withSiblingBefore = getSiblingBeforeProps => Current => SiblingBefore => props =>
  [
    <SiblingBefore key={0} {...getSiblingBeforeProps(props)} />,
    <Current key={1} {...props} />
  ]

const withSiblingAfter = getSiblingAfterProps => Current => SiblingAfter => props =>
  [
    <Current key={1} {...props} />,
    <SiblingAfter key={1} {...getSiblingAfterProps(props)} />
  ]

const withParent = getParentProps => Child => Parent => props =>
  <Parent {...getParentProps(props)>
    <Child {...props} />
  </Parent>

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.