4 ms·
A quick correction to the following claim: > ... if you wanted to insert <li> on the top of a <ul> form, then the React framework would misjudge that you modif
by yawaramin 10y ago
A quick correction to the following claim:
> ... if you wanted to insert <li> on the top of a <ul> form, then the React framework would misjudge that you modified all components of <ul> and appended <li> at the end.
Yes, that will happen ... but only if you don't assign a key property to each of the `<li>`s. React uses the key prop to uniquely identify nodes that were actually changed versus ones that were just moved around among their peers. So if you're dynamically creating lists of nodes of the same tag type, you really need to be giving them a unique `key`.
Also, it's not a framework, it's a library. A framework calls your code, a library gets called by your code. With React you call `ReactDOM.render` or similar.