Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

refactor: Use function components, remove React class #355

Merged
merged 8 commits into from
May 23, 2019

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented May 21, 2019

I didn't do the ones in Onboarding. We could maybe do them with #67

@amaury1093 amaury1093 marked this pull request as ready for review May 22, 2019 16:04
};
export function CopyButton (props: CopyButtonProps) {
const { value } = props;
const [copied, setCopied] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like you're specifying the state types in other components, so even though it's obvious here what the types are I think it'd be worth doing so here as well for consistency. useState<boolean>(false)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I'd prefer not to put explicitly. TS type inferring works pretty well, and someone seeing useState(false) knows immediately it's a boolean.

The reason why I put in some cases is that TS cannot infer the type, and needs a hint.

@@ -6,21 +6,19 @@ import React from 'react';
import { Form } from 'semantic-ui-react';
import SUITextArea from 'semantic-ui-react/dist/commonjs/addons/TextArea';

type Props = {
export type TextAreaProps = {
Copy link
Contributor

@pmespresso pmespresso May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't personally see a need to export this?

Copy link
Contributor Author

@amaury1093 amaury1093 May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was maybe anticipating a scenario that won't happen:

import { BalanceDisplay, BalanceDisplayProps} from '@substrate/ui-components';

const MyBalance = styled<BalanceDisplayProps>(BalanceDisplay)`
  // some css stuff
`;

or interface MyBalance extends BalanceDisplayProps;

anyways, removed

Copy link
Contributor

@pmespresso pmespresso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

several small comments, overall looks awesome though. I'm excited to be using more fp-ts!

@amaury1093
Copy link
Contributor Author

Let's ignore codeclimate issues for this one, I'll focus on them in the next PR

Copy link
Contributor

@pmespresso pmespresso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pmespresso pmespresso merged commit 42db864 into master May 23, 2019
@amaury1093 amaury1093 deleted the am-remove-class branch January 20, 2020 15:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants