3 ms·
Context: I don't much like the JS frameworks (Vue, React, Angular), even tho I really like JS. I consider there's probably a "better" and more pure (regarding J
by dosy 8y ago
Context: I don't much like the JS frameworks (Vue, React, Angular), even tho I really like JS. I consider there's probably a "better" and more pure (regarding JS, HTML, the web and the browser) way to develop web apps, and for views I tend toward using ES6 template literals rendered on the server, and on the client (as an alternative to excess JS and style encapsulation (through Shadow DOM or otherwise), I use named iframes and forms targeted to those.
But purely as a challenge and out of curiosity I'm trying to see if this approach I tend towards (specifically the ES6 template literals) can do what React does. So I'm trying to follow along with the React Introduction documentation, and implement what I see there in as few lines of pure JS as possible (without using JSX / AST parsing / or otherwise transpiling the language ).
So far I've gotten to part 5 of the React Introduction, the "State and Lifecycle" section, and have implemented the main demos before "state" is added. I've put them all on one page using iframes purely for convenience.
Tested on IE 11 (but failed as ES6 template literals are not supported), and worked on Edge 12, latest Chrome stable and Firefox dev on Windows 10.
Source: https://github.com/dosyago-coder-0/explore-react-without-react https://github.com/dosyago-coder-0/explore-react-without-rea...
If you're not familiar with the React Introduction documentation (specifically it's Demos and Examples) this may not mean very much to you. But if you're interested in how I'm doing it, take a look at the source. I've tried to keep it faithful to the Demos and make as few changes as possible.
I'd like to make it through the rest of the Introduction to React and reflect on this approach and if it's a useful alternative for me. Maybe this should be a Medium post titled "Implementing React without React." I might write one if many people want that.