Echo JS 0.11.0

<~>
Hartbeatnt 2201 days ago. link parent 1 point
makes sense! thanks for the explanation 👍

So I'm guessing this is more targeted towards apps that are not already using a utility for currying, such as ramda or lodash. Or does it provide additionally utility specific to lifecycle methods that other libraries might not provide?

Replies

planttheidea 2199 days ago. link 1 point
while i love functional utility libraries like ramda, the goals with this library are a little different because they are react-specific.

first, making your lifecycle and instance methods pure functions which receive the instance means that you can test them without actually creating an instance ... you can pass a mock object with the appropriate values that you know exist because of the contract. this makes testing both simpler and much faster. it also generally means writing simpler code that reads more declaratively.

second, when coupled with the createComponent method, you can build a stateful, lifecycle-aware, ref-capable component from a standard functional component. this allows for easier augmentation of an existing "dumb" component without having to refactor the entire file to use the class infrastructure.

third, if used across the board, it creates a more consistent implementation of React ... smart and dumb components have the same interface, just additional options applied.

the inspiration behind this is a React-like implementation called deku => https://github.com/anthonyshort/deku. it is kind of a dead project now, but i always appreciated the simplicity of the code you would write with it, so i found a way to make a similar interface with React.