Skip to content

Refactoring swapper with functional component#7

Open
valours wants to merge 1 commit intoVeloraDEX:masterfrom
valours:refactoring-suggestion
Open

Refactoring swapper with functional component#7
valours wants to merge 1 commit intoVeloraDEX:masterfrom
valours:refactoring-suggestion

Conversation

@valours
Copy link
Copy Markdown

@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