3 ms·
> React is ONLY THE VIEW LAYER. > React gives you a template language and some function hooks to essentially render HTML. This is actually wrong, despite the
by staltz 11y ago
> React is ONLY THE VIEW LAYER.
> React gives you a template language and some function hooks to essentially render HTML.
This is actually wrong, despite the official page saying the same. It's the biggest misconception in the React community. render() function outputs a data structure which describes HTML and ALSO user event handlers on that HTML. Any UI program does both: handle input user events and generate graphics output. A View is only the latter part, hence React cannot be only the View.
Refer to original MVC paper http://heim.ifi.uio.no/~trygver/1979/mvc-2/1979-12-MVC.pdf http://heim.ifi.uio.no/~trygver/1979/mvc-2/1979-12-MVC.pdf
> A view is a (visual) representation of its model.
> … a view should never know about user input, such as mouse operations and keystrokes.
- clay_to_n 11y agoIsn't it referring to the V in MVC? If that's the origin of "React is ONLY the view layer", then I think it fits.