2 ms·
JSX doesn't violate referential transparency. A component either is referentially transparent, or it isn't; nothing about how it's invoked changes that. Put an
by jakelazaroff 8y ago
JSX doesn't violate referential transparency. A component either is referentially transparent, or it isn't; nothing about how it's invoked changes that.
Put another way: React calls your components, not you. You pass the component function itself to React.createElement, not its result.
- dakom 8y ago> You pass the component function itself to React.createElement, not its result. JSX prevents you from being able to do this directly. For example, <() => "hello" /> is illegal.