Ducks Pattern
ducks pattern

Ducks Pattern

The Ducks Pattern is a way to organize the Redux structure and the Redux is a library of state control based on Flux architecture commonly used in the React ecosystem.

Redux even being a good way to control the React states there is a problem with the folder structs that are used, the way the files and folders are structured is a little problem.

Organization commonly used

In the common organization is based on the module, there a problem because

N?o foi fornecido texto alternativo para esta imagem

is a little hard to find some things, there is everything together is a bit confused and it'll be getting hard and hard when the application coming to grow the organization will start to be a little less organized. There will be a lot of name repetition and the folder has a lot of imports and exports.

Module organization

The other way is the following one that I particularly like more than the other

N?o foi fornecido texto alternativo para esta imagem

but there is still has a problem because to make on little think we have to create 3 files and some of them isn't that long, use it is separate thinks that is about the same contexts and it doesn't make sense. As an example, we can use auth. there is the type that is used to shot the action and the reducer they are 3 pieces of the same thing, separate them is like we have a car and we separate the car's hood, dashboard, and engine. Doesn't look right.

Ducks Pattern

Now we put together the reducers, types and actions and only one file and how to worry about because normally the file wont' get longer.

N?o foi fornecido texto alternativo para esta imagem

As you can see in only one file we can put all that you need,

要查看或添加评论,请登录

Guilherme Lisb?a的更多文章

  • Dataform

    Dataform

    Dataform é uma ferramenta de gerenciamento e transforma??o de dados que permite aos analistas construir e manter…

  • How to Use Advanced Techniques in BigQuery to Optimize Your Queries

    How to Use Advanced Techniques in BigQuery to Optimize Your Queries

    BigQuery is a data analytics tool from Google that allows users to perform complex queries on large datasets with ease.…

  • SQL Tips and Tricks

    SQL Tips and Tricks

    Here we'll propose a advantage use cases to improve your query performance and make your query less complex. Common…

  • ETL x ELT

    ETL x ELT

    When we think in how to bring data from data sources and databases into a lakehouse we can use ETL or ELT. Extract :…

  • RDD vs DataFrame vs DataSet

    RDD vs DataFrame vs DataSet

    Talking about Spark there are some things we need to know. The first is about RDD, DataFrame, and DataSet.

  • Root import

    Root import

    The root import is a tool that helps us to easily import a module from anywhere that is. React Js First of all, you…

  • Por que usar Typescript ?

    Por que usar Typescript ?

    Essa é a pergunta que eu sempre escuto sempre que estou sugerindo que seja realizado usando Typescript. Por que usar…

  • How to use Redux with AsyncStorage

    How to use Redux with AsyncStorage

    First of all, may you’re wondering why should you or anyone use the Redux with AsyncStorage, because is easier to use…

社区洞察

其他会员也浏览了