Hello Habr! i am Milo\u0415\u040e from Badoo, and also this is my very first Habr post, initially posted inside our technology web log. Hope you enjoy it, and please share and remark when you yourself have any concerns<\/p>\n
So\u0432\u0402\u00a6 React, amirite.<\/p>\n
It starred in the center of the ten years (suffering from the endless JavaScript framework wars), embraced the DOM, surprised every person by blending HTML with JavaScript and changed the internet development landscape beyond recognition.<\/p>\n
Dozens of accomplishments, without also being a framework.<\/p>\n
Think it\u0432\u0402™s great or hate it, React does one task very well, and that’s HTML templating. Along with a healthier ecosystem, it is perhaps perhaps not difficult to realise why it became probably the most popular and influential JavaScript libraries, or even the most famous certainly one of all. <\/p>\n
Right right right right Here within the mobile phone Web group, we don\u0432\u0402™t follow any strict JS frameworks – or at the very least, any popular people – and now we work with a mix of legacy and modern technologies. Although that actually works well we wanted to alleviate this by reducing the number of \u0412\u00abmanual\u0412\u00bb updates, increasing our code reuse and worrying less about memory leaks for us, manipulating DOM is usually hard, and.<\/p>\n
After some research, respond had been considered the best option therefore we chose to opt for it.<\/p>\n
We joined up with Badoo in the exact middle of this procedure. Having bootstrapped and labored on React projects previously, I happened to be conscious of its advantages and disadvantages in training, but migrating an adult application with billions of users is an entirely various challenge|challenge that is completely different. <\/p>\n
Respond mixes HTML with JavaScript in a structure called JSX. If you will, for React calls, very similar-looking to HTML although it looks like a template language, JSX is actually just a syntax, or syntactic sugar.<\/p>\n
Our own HTML files had been well organised, & most of our rendering ended up being done since just as template.render() . Just how could we retain this simplicity and order while going to respond? For me, technical problems apart, one concept ended up being apparent: change our current phone calls with JSX rule.<\/p>\n
After some planning that is initial offered it a chance and wrapped up a command-line tool that executes two easy things:<\/p>\n
Needless to say, this will just go us halfway, because we might nevertheless need to change the rule manually. Taking into consideration the amount and quantity of our templates, we knew that the most readily useful approach is one thing automatic. The initial concept sounded not difficult \u0432\u0402\u201d and if it could be explained, it may be implemented.<\/p>\n
After demoing the first device to teammates, the feedback that is best i obtained ended up being that there’s a parser readily available for the templating language we used. Meaning that people could parse and convert rule a lot easier than we’re able to with regular expressions, as an example. That\u0432\u0402™s whenever knew that work!<\/p>\n