{"id":373,"date":"2019-05-11T13:50:58","date_gmt":"2019-05-11T12:50:58","guid":{"rendered":"https:\/\/codizon.com\/?p=373"},"modified":"2021-04-14T22:15:03","modified_gmt":"2021-04-14T21:15:03","slug":"unidirectional-flow-for-beginners","status":"publish","type":"post","link":"https:\/\/codizon.com\/2019\/05\/unidirectional-flow-for-beginners\/","title":{"rendered":"Unidirectional Data Flow for Newbies"},"content":{"rendered":"\n
Unidirectional Data Flow<\/em> is a buzz phrase that thrilled development conferences all around the world. There are plenty of frameworks that now use this concept such as State Machines<\/a>, Redux<\/a>, Flux<\/a>, Bloc<\/a>, Mobx<\/a>, among others. These are widely used on all frontend platforms (mobile, web, desktop applications, etc.) regardless of programming language or framework.<\/p>\n\n\n\n First, what does “unidirectional<\/em>” mean? In simple words, it means that data only has one way to be transferred to other parts of an application (i.e., a single input leads to a single output). Have you ever encountered issues like concurrency modification exceptions or race conditions? These can all be tackled with a unidirectional flow approach since only one function and one thread can make changes at a time.<\/p>\n\n\n\n Events<\/em> (or “actions<\/em>“) describe mouse clicks, network call completions, input changes, etc. All are added to the FIFO queue.<\/p>\n\n\n\nKey Concepts<\/h2>\n\n\n\n