Functional programming in Javascript is an antipattern

Functional programming in #Javascript is an antipattern:  by @a_dixon #ReactJS

  • But I imagine I’ve thought them a million times before and didn’t notice because it was all I knew.I don’t think there’s a way to avoid this kind of thinking when writing Javascript using any combination of React, Redux, ImmutableJS, lodash, and functional programming libraries like lodash/fp and ramda.I need the following in my head at all times:APIs for lodash, Immutable, lodash/fp, ramda, and native JS or some combinationmutable programming techniques when working with Javascript data structuresimmutable programming techniques for Immutable data structuresimmutable programming with mutable Javascript data structures when working with Redux or ReactIf I manage to keep that in my head, I still run into a tangle of questions like the ones above.
  • The only way I can find to avoid this is to not go down the path in the first place — don’t use ImmutableJS, immutable data structures, immutable data as a concept in Redux/React, or ramda, or lodash.
  • It was designed from the ground up as a functional programming language that operates on immutable data structures.
  • Unlike with a language that compiles to Javascript alone, you have the option of writing a Java-based server that supports multithreading.As an average Javascript/Node developer, it hasn’t been difficult for me to learn the language or the ecosystem.What makes Clojurescript easier?Run whatever code you want inside your editor.You can run any code in your editor with a keypress.
  • Clojurescript is a functional programming language from the ground up — implicit return statements, functions are first class, lambda expressions, etc.Use anything you want from Javascript.

After a few months writing Clojure I began writing Javascript again. As I was trying to write something ordinary, I had the following thoughts: They seemed unnecessary. But I imagine I’ve thought…
Continue reading “Functional programming in Javascript is an antipattern”

Building a Card Swiper in React Native

  • There’s way too many things this component exposes as props.
  • The Animator wraps your card components to make them tossable.
  • This first one is the Card component.
  • The only things I see needing optimizations other than the rendering performance is how the actions bar is hooked into the card stack.
  • It’s my hope with the community’s help we can make this the best card swiper for React Native.

This past month, a friend and I have been working on releasing React Screens. We plan on making two screens, complete with various UI elements that you can use some of, or the whole screen, in your own React Native apps.
Continue reading “Building a Card Swiper in React Native”

Thoughts on Redux – Pietro Ghezzi – Medium

Important read: Thoughts on #Redux  #ReactJS #JavaScript

  • Mostly for CRUD operations.The first problem was to denormalize the entire state (the use of the library “normalizr” is encouraged by redux docs, I didn’t know it when I started and I did it manually) in a way to split it in small pieces, each with a reducer.
  • It’s useful and speeds up a lot the development process.DemoSummary of my pros and consProsTest driven development is made easy, thanks to pure functions, and increases the development productivityOnly the root component (I call it container) is connected to the reducer, all the actions and state are passed through props.
  • This makes it easy to use component composition and write stateless components.Code linearity, everything is simple and doesn’t differ much from one project to another.Immutability: forcing to keep an immutable state helps a lot avoiding weird bugs.The Log middleware in dev mode, showing all the different states before and after an action is dispatched, is of a great help.ConsIt’s difficult to handle relationships and there isn’t any official library with documentation and support to help you with it.Redundant code, every action is written manually, even the most common, like changing an attribute of the state.Normalizing a complex state with many level of nested objects doesn’t always seem the best approach.My best practicesDirectory structure by module instead of scope.
  • A better approach it could be to retrieve the new state from the server when necessary and handle the state relationships on the database layer.TDD on reducers, tests on reducers not only speed up the development but also cover you on possible “silent” bugs on the state.Keep components simple and use component composition.Normalize the state with the use of Reselect libraryHandling complex store relationships (#386)Note from Dan AbramovDeleting is always tricky because there is no first class notion of a schema.
  • These reducers will know when to remove IDs from foreign key fields because they know what the schema looks like.Dependencies I will consider in for managing complex form stateRedux-ormA small, simple and immutable ORM to manage relational data in your Redux store.It would be great if CRUD operations were managed with the model declaration with no need to write actions manually.Redux UIGood solution to separate the UI state from the application state.NormalizrLibrary suggested in the official redux documentation for normalizing the application state.Main dependencies for this projectReactReduxReact router v2Redux ThunkReact DnDReselectStyled componentsReact BootstrapBootstrap Material DesignJestConclusionRedux is a good solution for handling complex interface, it is very similar to flux architecture, but if I have to rewrite the application, I would do it in a different way.I would avoid to specify all the logic on the client, moving a part on the server side.A good approach I have seen in some projects, it is to dispatch the actions to the server and with a websockets connection, notify all the connected clients of the changes made.This way the client is responsible only to denormalize and normalize the state received by the server, handle the UI state and presenting the data.On the server side is much easier to handle relationships with an ORM provided by a web framework.This project has been of a great help to make me understand all the caveats redux can reserve for a medium size application.

I have been working on my first project with Redux for the last few weeks. An admin interface to manage and create questionnaires about patients data collection. When writing a small application…
Continue reading “Thoughts on Redux – Pietro Ghezzi – Medium”

An Introduction to React and React Native

Have you signed up yet? [webinar] AN INTRODUCTION TO #REACT AND #REACTNATIVE #javascript

  • Ricochet Consulting, Inc. � 2017
  • In the webinar, we’ll discuss the pluses and minuses of React and React Native, what makes them different, and how to decide if you should use React or React Native.
  • Interested in finding out if either React or React Native is a good solution for your project?
  • An introduction to
  • react and react native

In this webinar we’ll share what React is, what React Native is, how it works, its key benefits, how you can adopt it within your organization, and whether or not you should.
Continue reading “An Introduction to React and React Native”

Javascript Fatigue – Medium

#Javascript Fatigue:  by @ericclemmons #reactjs #Redux

  • Instrumenting tooling should aim to be as minimal as possible .
  • Yeoman & Plop can alleviate the amount of copy & pasting you do between projects.
  • When a generator is good solution for repetitious code, a better solution is to abstract it into a simpler API.
  • I say “painstakingly” because every project required decisions to be made around tooling depending on the scope & needs.
  • Even if contained in a “boilerplate” project, scaffolded by a generator, or tucked away in a finalCreateStorev3SeriousThisTime.js file, we’ve created a rat’s nest of wiring that would make WordPress plugins blush.

A few days ago, I met up with a friend & peer over coffee.
Continue reading “Javascript Fatigue – Medium”

Evolving Yahoo Mail

.@Yahoo chose @ReactJS + Flux for building their next generation Mail:

  • Link: Yahoo Mail moving to React
  • For the next generation Yahoo Mail platform, we wanted
  • The “one way data flow” appealed to all developers in the team as a neat way to think about a UI application interactions.
  • Yahoo Engineering – All Rights Reserved.
  • Last month Yahoo hosted the React JS meetup in the Sunnyvale Campus .

Evolving Yahoo Mail Yahoo Mail has been around since 1999. Over the years, the code base has evolved from a completely server rendered Web 1.0 app all the way to one of the largest YUI based rich…
Continue reading “Evolving Yahoo Mail”

Why Redux is not so easy, some alternatives

  • The global state tree is cumbersome to maintain.
  • Since the state tree needs to be immutable, lists also need to be.
  • When there is a user, we can load the lists.
  • Dispatch, also, by idiom/default, does not get access to the state tree.
  • A reducer is responsible for just one branch of the state tree.

Why Redux is not so easy, some alternatives | r/reactjs at
Continue reading “Why Redux is not so easy, some alternatives”