Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn McMullen
179 PointsWith jQuery you can programmatically remove a list item and build from an array. How is that different than React?
Trying to contribute something non-beard related here. I've been learning React and love certain things about it, but in your example you talk about how if you change a line in jQuery, you'd need to go in to your <ul> element and delete the <li>. Most jQuery I write with dynamic lists use an array like React and modify the list accordingly. What's the difference here?
1 Answer
Zack Lee
Courses Plus Student 17,662 Pointsfrom what I understand, React is declarative, meaning, the code you write is what you want your DOM to look like once all is said and done. When using React you interact with a virtual dom, which has a bunch of code behind it that interacts with the actual dom. So you write a "description" of what your dom will look like after everything is rendered. React takes care of everything else.
Jquery however is imperative, meaning you're writing what you want to happen.
this is all fuzzy really and comes down to implementation and developer workflow and things like that as well as data and state management which can get really complicated with large projects.
heres an article that says it better than me:
https://tylermcginnis.com/imperative-vs-declarative-programming/