Jest and the Component Driven Development (CDD) – Comunidad JS – Medium

#Jest and the Component Driven Development (CDD):  #ReactJS #JavaScript

  • Jest and the Component Driven Development (CDD)Testing React and React Native applications.We all knows about TDD right ?
  • I recently discovered other flow/flavor around React Components and Jest snapshot testing that makes me more happy and encourage me to write more tests.This approach makes the dev process a bit more fun that the other way around.
  • Then, when you´re confortable with your component code base and you have applied all the good practices out there, write the actual test, passing the required props to the component being tested and expect it to match the snapshot.Snapshot testingSnapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.The above statement, is from the Jest documentation, and it´s 100% true.
  • I’ve found snapshot testing to be a quick and fun way to test Components and make sure your UI does not change unexpectedly, which is a good thing.The test will fail if the two images do not match: either the change is unexpected, or the screenshot needs to be updated to the new version of the UI component.That means we are not passing the expected props to our component in some parts of our application or we have adjusted the component (because we´ve refactored it).
  • So either one or the other possibility, we need to update the test snapshot (If we´ve refactored it) executing in the terminal yarn test -u or go and fix the part in the application where we´re not using the component as we expect.Having a test coverage between 80 and 100% make us more confidents when we need to deploy to any environment and allows applications to be more robust and easy to scale.In closing, I really encourage React developers to use Jest for testing applications.

We all knows about TDD right ? Test Driven Development.
The philosophy behind it, is to start the development cycle with first writing a failing test and then writing the actual function, to make it…
Continue reading “Jest and the Component Driven Development (CDD) – Comunidad JS – Medium”

Organizing Large Redux Projects – Collaborne Engineering – Medium

Organizing large #Redux projects:  #ReactJS

  • Now, data handling is no longer buried deep in the UI component files but split out in separated files for action types, reducers, actions, and selectors.Organize by featureInitially we kept the Redux files alongside the UI components, which we organize by feature area (e.g. users-related functionality is in users/ action-types.
  • But the structure has also two major flaws:Redux related functionality is not grouped: The Redux code has to interact across features, e.g. a group has members, which are modeled as users.Data management for UI and for data model is mixed up: The users reducer manages a lookup table byId (i.e. access to the real data) as well as the ID of the currently viewed user.
  • html), which itself only holds the IDs of the members.Match UI components, Redux code, and state shapeTo addressed these two issues, we re-organized the code by UI components vs. Redux and then by data vs. UI:components/ users/ user-ui.
  • html actions.html reducers.html selectors.html reducers.html ui/ users/ action-types.
  • This allows to easily compose the reducers, e.g. the UI reducer brings together the reducers for the users and groups UI:uiReducer = Redux.combineReducers({ users: uiUsersReducer, groups: uiGroupsReducer});Happy coding!Want to learn more about Polymer?

Since we moved to Redux, our data management is finally properly split from our UI components. Now, data handling is no longer buried deep in the UI component files but split out in separated files…
Continue reading “Organizing Large Redux Projects – Collaborne Engineering – Medium”

So you want to learn React.js? – EdgeCoders

So you want to learn React.js?
#reactjs #js #coding  #programming @samerbuna

  • Identify whether what you’re currently learning is React or not, mainly so that you don’t get confused about your effort to learn React itself.
  • I find building simple games to demonstrate the ideas of React much better than starting with data-driven serious web applications.
  • React ecosystem libraries: Since React is just the UI language, you’ll need tools to complete the picture and go beyond even MVC. Don’t start until you’re very comfortable with React itself.
  • Right after getting comfortable with the raw concepts of React itself, build a React Native app.
  • I’ll give you two things to focus on, just forget everything else you encounter and learn these two first once you’re done with React itself: react-router and redux.

First, make peace with the fact that you need to learn more than just React to work with React. This is a good thing, React is a library that does one thing really well, but it’s not the answer to…
Continue reading “So you want to learn React.js? – EdgeCoders”

Vue.js Is Good, but Is It Better Than Angular or React?

#VueJS Is Good, but is it better than #AngularJS or #ReactJS? - DZone Web Dev

  • We would like to compare these two frameworks from a developer’s perspective with a few simple how-tos for each framework.
  • Neither Vue.js is new nor less popular compared to other frameworks as per it’s lifetime.
  • Overall, Vue provides an answer to the issue of React & Angular and gives you much simpler and easier way to code.
  • Combining with some other tools It also becomes a “framework”.
  • From our last blog on ValueCoders , you already know that Vue.js is one of the top JavaScript frameworks and it is replacing Angular and React in many cases.

The greatest benefit of Vue is it’s absence of pedigree. It is fresh and has little baggage.
Continue reading “Vue.js Is Good, but Is It Better Than Angular or React?”

Snapshot Testing: Use With Care

  • When writing Snapshot Tests that are intended to stick around, you need to be careful to write really solid test descriptions, because the body of the test no longer communicates anything about what’s important about the test case.
  • During future runs, the test will compare the latest JSON with the snapshot file.
  • Snapshot Testing in Jest was designed to make it easy to test React components, but it can be used for more than that.
  • The ability to quickly update a snapshot when it changes makes for a nicer, faster workflow.
  • It is definitely worth experimenting with Jest’s Snapshot Testing feature.

Snapshot Testing has been getting a fair bit of attention recently with some new tool support that makes it easy to use. But is that a good thing? …
Continue reading “Snapshot Testing: Use With Care”

sriraman’s response to Differences between MobX and Redux? Which one to use when?

How is #MobX different from #Redux? What to use when?
Top response:  🔥


  • Actions and state changes are very traceable
  • actions are really straightforward; you don’t have to return new data structures etc.
  • functional programming oriented, which offers cool benefits like time travelling, trivial action testing and such
  • Very suitable for a state tree that has lot of inter data relationships; the data doesn’t need to be normalized to a tree
  • Simpler to work with async actions

Read the full article, click here.

@Hashnoder: “How is #MobX different from #Redux? What to use when?
Top response: 🔥


MobX has been getting some momentum lately. How is it different from Redux?

sriraman’s response to Differences between MobX and Redux? Which one to use when?