React setState Tutorial 2017 - Add items to a list

preview_player
Показать описание
Learn how to modify React state using the setState method.

React 101 - Free Online Course

Want to see more React tutorials? Let me know in the comments.

THE BEST OF

SUBSCRIBE

LET'S CONNECT!
Ihatetomatoes

Petr Tichy
Рекомендации по теме
Комментарии
Автор

Great video Peter! I have only one question. In addItem function you define buyItems const by destructuring but I dont see any usage of it. Am I missing something?

MAgeCZ
Автор

would love to see an example utilizing bootstrap + react + axios, populating data in a bootstrap table via some api and using various bootstrap elements. Love your work!

Checkout:


fahadbilal
Автор

How to do this if we have multiples input fields.. Like name, age, country ?

deepikasrinivasasharma
Автор

im having issues trying to implement "ref" to Form.Input from semantic-ui-react, if i use a regular form input it does work... i heard i can use onchange to solve this .. any ideas???? i get this error....

```
×
TypeError: Cannot read property 'value' of undefined
Tablex.addItem
src/Tablex.js:21
18 | addItem(e){
19 | e.preventDefault();
20 | const {buyItems} = this.state;
> 21 | const newItem = this.newItem.value;
22 |
23 |
24 | this.setState({
View compiled
onSubmit
src/Tablex.js:43
40 |
41 | <h1>Shopping List</h1>
42 |
> 43 | <Form onSubmit={(e) => {this.addItem(e)}}>
44 | <Form.Group inline className="form-add">
45 | <Form.Input ref={input => this.newItem = input} type="text" placeholder="New Item" className="form-add" id="newItemInput" />
46 |
View compiled
▶ 21 stack frames were collapsed.
```

peterdaze
Автор

I have a question. Im trying to use the react toolbox api on a project. but idk how to export the css content to a external css file to add it on my website.
I have the same setup from webpack 101 course.

Thanks in advice

deijutsu
Автор

what to do if you have 2 input fields?

NoonGalaxy
Автор

Awesome video man! I suppose you're covering great stuff like refs and keys used in a very simple fashion.

According to my observations - people still don't use the aforementioned features, for as much useful as they are. Some even try to get away with jQuery as an alternative to it(which, in my opinion is inappropriate).
I suppose you'll also cover some scenario for _forceUpdate()_ function of react? Please do so.

Anyways, great videos!! Can't wait for the next one!!

shrikantraut
Автор

Would really love a video of how you integrated react with twitter bootstrap.

alistairlobo
Автор

It proved really useful for me. Thanks a ton!!

amankumarsingh
Автор

Love your video so much.
I have question about ref, why you dont use ReactDOM.findDOMNode to get ref value?
and than about onSubmit action {(e) => {this.addItem(e)}} what differences thats action with {this.addItem.bind(this)} ?? i got tutorial using {this.addItem.bind(this)} << this query on meteor website

Thank You

wisnuaryadipa
Автор

I want to know you as a person... I feel like I should do more for you. This is prolly one of the best...

jerrynwaeze
Автор

Thanks, such a great tutorial, well explained..

daniyalkhan
Автор

very well explained.. u r doing good job. i appreciate it

pankaj_
Автор

Thanks for the great video!
One question: how do I handle multiple fields? Let's say "Item" and "quantity"?

TheCastaz
Автор

Sir i just love urs videos... And also ilove tomatoes

vikasni
Автор

Petr, do you have any guidance on how to get up to speed with styling/svg, like how you redesigned the layout from the last video?

paulpeterson
Автор

tq sir babanas for the tutorial. subscribed

downforce
Автор

Thank you! Can't wait for each new tut!

phillipscards
Автор

good, but one thing may be confusing for some, you use input on the form ref and if you said it would change to {form => this.addForm = form} would be nice.

GniewkoOstrowski
welcome to shbcf.ru