Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

yes, well if I didn't use most of the built in functionality of a framework I suppose it would be a lot more like using a library.


Support for JSX is not built into React. React is simply a JS library and JSX is not valid JS. So if you add React to a web page, and attempt to write logic with JSX, you will get syntax errors.


No, it's literally the case that JSX compiles into (indirect) calls to your own functions. It's not a magic 'framework' that calls your code when you use JSX, it's... your code.

When you write

   return <MyFunction foo={bar}/>
that gets turned into

   return React.createElement(MyFunction, { foo: bar }, [])
Which returns a refreshable wrapper round the result of calling your function.

It's really a reactive-functional type system, rather than a framework - with a syntactic sugar that makes it easy to generate a reactive wrapper round a function.

Then you take the result of passing all your functions into that syntactic wrapper and hand it to ReactDOM to have it synchronize it with the DOM.

React transcends the framework/library discussion because it really isn't either. It's a higher-ordered type factory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: