Skip to content
This repository has been archived by the owner on Apr 30, 2023. It is now read-only.

Add post-launch tweaks #10

Merged
merged 6 commits into from Mar 9, 2020
Merged

Conversation

BenLorantfy
Copy link
Contributor

@BenLorantfy BenLorantfy commented Mar 4, 2020

Implements changes described in #7 and reduxjs/redux-templates#3 (comment)

Screen Shot 2020-03-03 at 11 59 28 PM

animation (1)

@BenLorantfy
Copy link
Contributor Author

TS PR: reduxjs/redux-templates#6

}
>
Add Amount
</button>
</div>
<div className={styles.row}>
Copy link
Contributor

Choose a reason for hiding this comment

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

The layout here feels a bit confusing to me after looking at the gif, in a couple ways:

  • The buttons aren't aligned
  • It's surprising to me that "Add Async" doesn't add the amount in the textbox

Can we put the textbox and both buttons in a single row, and make this do dispatch(incrementAsync(incrementAmount) ? That also lets us show passing an argument to a thunk while we're at it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, given that, would it be better to store the amount as a number permanently, and do the number conversion in the onChange handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it will lead to a simpler example if we leave it stored as a string. Storing as a number means we'd be doing a form of input masking, which requires more code to make work properly for things like "", "1.", "001", and other intermediate forms of number inputs. I talked a little more about this in reduxjs/redux-templates#3 (comment)

export const { increment, decrement, incrementByAmount } = slice.actions;

export const incrementAsync = () => dispatch => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a comment here saying that this is a thunk, and you can do async logic inside.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a shot at adding a comment. Let me know if you want different wording

@markerikson
Copy link
Contributor

Requested tweaks apply to the TS side as well.

(Also, neat animation on the button!)

@markerikson markerikson mentioned this pull request Mar 4, 2020
@BenLorantfy
Copy link
Contributor Author

@markerikson Made those changes. If they're all good I'll make the same to the TS PR.

@markerikson
Copy link
Contributor

I like it. Let's do this. Go ahead and update the TS repo accordingly. Thanks!

@markerikson markerikson merged commit e500809 into reduxjs:master Mar 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants