---
title: "Discussion on \"Improving testability of your react components\" | Hashnode"
description: "Discussion on \"Improving testability of your react components\". If you ask any developer about tests, they answer that tests are essential. They indicate that the code works as intended and that your new change didn’t break something else. However, if you go into almost any React project, you can notice that thei..."
url: "https://hashnode.com/posts/improving-testability-of-your-react-components/60256435c6d91052dafe8c55"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Improving testability of your react components](https://kristijan-pajtasev.hashnode.dev/improving-testability-of-your-react-components?utm_source=hashnode&utm_medium=feed)

If you ask any developer about tests, they answer that tests are essential. They indicate that the code works as intended and that your new change didn’t break something else. However, if you go into almost any React project, you can notice that thei...

Feb 11, 2021 · 10 min read · kristijan-pajtasev.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#testing](https://hashnode.com/tag/testing)

## Written by

[Chris](https://hashnode.com/@kristijan-pajtasev)

@kristijan-pajtasev · Dublin, IE

  
[View profile](https://hashnode.com/@kristijan-pajtasev)

JavaScript Developer, mentor and overachiever

Full-stack developer with a focus on JavaScript. Love mentoring and always looking for new stuff to learn and improve.

## Responses 3

Markdown supported · ⌘↵ to post

[Nik Sumeiko](https://hashnode.com/@niksumeiko)

[Mar 11, 2021](https://hashnode.com/posts/improving-testability-of-your-react-components/60256435c6d91052dafe8c55/comment/604a9956ad1cac7d577dfb67)

Hi Kristijan, pure functions handling business logic and smaller components are very useful software design concepts. Both also help to comply with a Single Responsibility Principle from SOLID. Each unit is doing its own job and has a single reason to change.

We strive to follow this in our huge codebase, too. Now with React hooks, we split it as follows:

1.  React components do just view rendering;
2.  Services (with pure functions inside) handle business logic;
3.  React hooks arranges business logic composition serving the view — they compose service operations.

This way everything is not just granularly separated and easy to test individually, but also very DRY (reusable).

[Edidiong Asikpo (Didi)](https://hashnode.com/@didicodes)

[Feb 12, 2021](https://hashnode.com/posts/improving-testability-of-your-react-components/60256435c6d91052dafe8c55/comment/60262cc1c6d91052dafe9802)

Bookmarked! This is very insightful and useful [Chris](https://hashnode.com/@kristijan-pajtasev).

[Chris](https://hashnode.com/@kristijan-pajtasev)

[Feb 12, 2021](https://hashnode.com/posts/improving-testability-of-your-react-components/60256435c6d91052dafe8c55/comment/60262cc1c6d91052dafe9802#reply-602661a637839f618a2c56ec)

Thank you Edidiong, I really appreciate the feedback

[Catalin Pit](https://hashnode.com/@Catalinpit)

[Feb 12, 2021](https://hashnode.com/posts/improving-testability-of-your-react-components/60256435c6d91052dafe8c55/comment/60262365c6d91052dafe95b2)

Super useful!

[Chris](https://hashnode.com/@kristijan-pajtasev)

[Feb 12, 2021](https://hashnode.com/posts/improving-testability-of-your-react-components/60256435c6d91052dafe8c55/comment/60262365c6d91052dafe95b2#reply-6026618937839f618a2c56e6)

Thank you, Catalin. I appreciate the feedback
