meteor / todos

The example app "Todos", written following the Meteor Guide
Other
535 stars 367 forks source link

React branch update with hooks - New react/typescript branch? #276

Open cvolant opened 4 years ago

cvolant commented 4 years ago

I searched several times for a good example app using meteor and react hooks, but the only meteor/react app I have ever found is this one and it doesn't use hooks yet. I think it is important since hooks is a major update of React, and updating meteor ecosystem to make it more attractive in a hot topic. Now that meteor supports typescript, it would also be good to open a typescript branch to showcase a meteor-typescript app. I could try to PR an update to React 16.10 with hooks and to open a react/typescript branch on top of it since I went through this process on my little app.

filipenevola commented 4 years ago

Hi @cvolant sure, please open your PR and let's do it.

cvolant commented 4 years ago

I now have a working branch that updates everything, transforms all class components into functional components, creates a simple hook-handled global state, fixes some issues (menu, not-found), improve PropTypes, BUT... breaks tests. :(

I searched for a solution a whole day without success: I am tired of it, and I have others things to do. Testing in Meteor already wasn't very documented long ago, and there isn't any other new documentation since then, so now it is both scarce and outdated... It would be great to be able to use react-testing-library...

Do you think I should submit the PR and then we try to fix the problem, or we first need to fix the problem? If anyone wants to try, here it is: https://github.com/cvolant/todos/tree/react-update-all+move-to-functional-components-with-hooks

filipenevola commented 4 years ago

@cvolant please submit the PR then we can work together in the testing part. Sound good?

cvolant commented 4 years ago

@filipenevola OK then here it is: https://github.com/meteor/todos/pull/277 If you can have a look at the tests, that would be great. I tried mounting, shallowing, rendering the ListHeader, but no luck, I keep running into errors no matter what I try with each of them...

cvolant commented 4 years ago

I improved the PR thanks to HorusGoul review. The tests are still broken, but it is better. The server tests all pass, but 3 of the client tests fail, I don't know why...