Now you are generating a new unique ID every time the component is rendered, which isn't really necessary - you only need a new ID whenever you're creating a new task. I guess it happens to work correctly even with how you've done it now, but initializing variables like that in the component body isn't really the correct way. The uniqueId variable should be initialised within handleAddTask before you add the task to the list.It's quite strenuous to read code where I have to dig into the implementation details to figure out what it does! Other than readability-wise, stricter typing like this is really what makes TS useful: it can help you catch if you made a typo, and do other useful things like autocomplete - with typing, a good rule of thumb is to make it as strict as you are able to. Now you are making me read through the code to figure out that it can actually be only !underline or underline (as far as I can tell), but you could have saved me that effort by typing it more accurately as style: "!underline" | "underline", or even changing the property to underline: boolean. For example, the style property in the Task type is now typed as just string, and as such I'm not really sure what I should do with it. Use TypeScript as a documentation tool: a big part of the value of TS is that it helps you write code that documents itself.A good excercise would be to split that into a TaskInput and a TaskList which renders TaskListItem components, as an example - that would make this component a lot easier to understand. Large components that do a lot of different things can be hard to decipher - you should break them down further! For example now Tasks.tsx contains the input for adding tasks, the list that shows them, and all logic related to adding/removing tasks as well.Here's a few thoughts based on one Pomodoro-length code review ) I'll use Tasks.tsx as an example: ![]() Looks good bud! And congratulations on releasing the project! ![]() Answers tagged reactjs on Stackoverflow.Join Reactiflux and check out #job-board (and the rules!).Like building things? People want to pay you to build things! CSS-in-JS: Emotion vs Styled-ComponentsĪlso don't forget to check out /r/reactjs alltime top posts! Links for further learning.Posting your app is a great way to get feedback regarding your work. Get Your Next Project Idea Here Got a project to show? Get an invite to our sub's chatroom, it's new! Talk in Real Time (tm)! Project Ideas Scrimba's React course by /u/mrborgen86./u/acemarke's suggested resources for learning React, JS, and more. ![]() Mods will remove such posts posted on other days. If you want to show off or need feedback on your portfolios, you should post on Sundays, and Sundays only. Therefore posts of NSFW React apps must link to source, not to the live NSFW app. We ask that NSFW posts nevertheless focus on the technology rather than the content. links to NSFW apps built with React) but try not to be prudes. Please link some source code (or if not possible, we understand, link some live demo or codepen so that people can try you out and learn from you) 6. We're all here to learn from you, but can't learn very much from a video recording. Demos should link source code or live demos If you need further guidelines on spam, see Reddit's guidelines on Spam. Per Reddit guidelines for self-promotion, you are definitely welcome to promote your own content as part of your participation in this community, but if you repeatedly post low quality crap you will be banned. Telling people to "get out" of the industry or that they are not good enough in some shape or form is a bannable offense. ![]() Reasoned criticism of React or any other library is welcome, but spare us your rants. Polite or Constructive criticism is welcome but don't rag on other people's work or attempts to improve themselves. Interested in building mobile apps using React Native? Check out /r/reactnative! Rules 1. A community for learning and developing web applications using React by Facebook.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |