surrealdb / awesome-surreal

A curated list of SurrealDB resources, tools, utilities, and applications.
https://surrealdb.com
Creative Commons Zero v1.0 Universal
443 stars 61 forks source link

React+Node starter #42

Closed MSaiKiran9 closed 1 year ago

MSaiKiran9 commented 1 year ago

My contribution for the issue #35

This starter contains front-end and backend app made with react and nodejs . More info is available in the Readme: https://github.com/MSaiKiran9/react.nodejs_starter#readme

If there's something that should be improved, do let me know !

kearfy commented 1 year ago

Hello @MSaiKiran9! Thanks for your Pull Request! I read through the code, and I have a comment on the way that you fetch data in the frontend. It is generally not recommended to use a state and an effect to handle data fetching in React, as it causes unexpected issues. Data fetching can be quite a difficult problem in React, but there are some amazing libraries out there that handle the boilerplate for you, and I thought it might be an idea to implement one of them 😃

Notably:

Would you consider using refactoring this bit of code? Let me know if you need any help!

Thanks ❤️

PS: Feel free to take a look at my project where I implement surrealdb.js with React myself 😃

MSaiKiran9 commented 1 year ago

@kearfy Thanks for letting me know I'm on it !

MSaiKiran9 commented 1 year ago

@kearfy I've refactored the code , I also forgot to put awaits while connecting to database and querying in the front-end's async block now it's okay , backend is also fine . I also used swr to update the frontend's UI every 10 seconds with the database data, if it has any updates . swr is really awesome .Thanks for the suggestion & let me know it it's okay now

MSaiKiran9 commented 1 year ago

Hi @Ekwuno @kearfy can you confirm if this is okay

kearfy commented 1 year ago

Hey @MSaiKiran9, your email got buried in my inbox, apologies! Will have a look tonight

kearfy commented 1 year ago

Awesome @MSaiKiran9, your changes look good, thanks! ~Last question: Could you update this PR so that there are no conflicts and so everything is in order?~

Updated the PR for you!

MSaiKiran9 commented 1 year ago

Thankyou @kearfy

naisofly commented 1 year ago

Hey @MSaiKiran9 Thank you for contributing to SurrealDB during Hacktoberfest 2023 🎉 Kindly send an email to community@surrealdb.com to coordinate the delivery of your SurrealDB swag! 😁