abak-east / bwa-u4-feature-request

0 stars 0 forks source link

Summary #5

Open ghost opened 6 years ago

ghost commented 6 years ago

Needs Improvement

Your suggested implementation might work but it is not an optimal solution. It's pretty easy to reach for this solution, especially when you've just spent so much time learning about React and all the wonderful things it can do for your web development projects. That being said, whenever you think of a feature you should first conduct adequate research so that you can make a more informed decision based on other programmers' experiences. This will allow you to make a more meaningful analysis in your technical design and caveat sections.

The simplest way to implement this feature does not require any React skill at all, not even any JavaScript! And, in fact, throwing a second event listener/event handler pair just adds unnecessary lines to your codebase as you add more and more forms to your application. It's not ideal for so much of your code to be dedicated almost exclusively to... duplicating form submission logic. At the very least, this is a tradeoff that you should consider in your request.

A quick Google would demonstrate how you might implement this with just HTML. All you really need is to change your div element to a form, use a single onSubmit event listener, and change the a element to an input element of type="submit". Try it out!

abak-east commented 6 years ago

Hi, I'm learning JavaScript, Python, ReactJS and others this year. I appreciate your feedback and I'm all about using simple solutions. I will try out your solution and research more about it. Just to clarify, the code works ("might" is incorrect). You could try it out here: https://abak_east_domain.surge.sh I googled for days, trying to find JavaScript or React solutions, as HTML was not one that I would fully understand, since the course focused more on JavaScript and React, but covered only basics of HTML and CSS. Therefore, I used the knowledge from the course to find a solution based on that path. I must say, pressing Enter has hundreds of threads and several experts trying to implement it using a different approach. None of those worked for me. As my last resource, I spoke to one of Codecademy advisers, who explained that my method on App.js would require two parameters to work (which was my missing piece), then I did my research on why key.code was not working for me, and found other methods that would. You could say that my research skills could be improved and I would agree with you on that as well. I enrolled now on a course that will teach me HTML and CSS to use their full potential. You could see my entire code here: https://github.com/abak-east/jammming

Note: I understand that, compared to an experienced programmer (such as yourself), this code is not optimal and I look forward to find better solutions, but given the fact that I just finished learning ReactJS and JavaScript, I'm truly proud of how I implemented that Enter feature.