Judge my React-foo (or lack thereof)


#1

I was just wondering if someone might be able to take a look at this sample React component, and see if I’m doing it vaguely correctly; whether there is a better way to achieve the same result?

Also, I am particularly concerned with the lines highlighted, I’m using them to effectively set the “initial state” to the existing value stored in the document, but it feels really clunky / hacky. Is there a better way?

Thanks for looking!


#2

Alternatively if someone wants to chime in with a recommended / their strategy for creating a React edit-form which is pre-populated with existing data from a document, that would be awesome! I’m just struggling a bit with the this.data vs this.state what should go where, etc. Especially when reactive-joins are involved on the document(s) in question.


#3

Just learning React too and found this example very helpful with respect to input fields. It’s a more complete version of the simple todos tutorial. It gives good insight regarding refactoring your code.


#4

Thanks @rdagger, while there isn’t an example quite like mine, there are definitely some things I can learn from this code and structure!