Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring swapper with functional component #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

valours
Copy link

@valours valours commented Oct 17, 2020

Hi Paraswap,

Your project is really interesting. I hope my help will be welcome

Class-Components vs Functional

The react team encourages developers to use functional components. The big difference is the syntax (lighter) and the possibility of using hooks. Another advantage is to be able to dispense with the operator this.

Power of hooks

it is possible to encapsulate the business logic in hooks and to separate it from the react component. This makes it easier to test the logic.
in this refactoring, it will have been possible to extract the business code in an even more meaningful way

Bonus

  • Add *.d.ts for fixing certain import in swapper

Good day !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant