Skip to content

State type inferrence #174

New issue

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

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

Already on GitHub? # to your account

Open
shaun-sweet opened this issue Jul 8, 2019 · 3 comments
Open

State type inferrence #174

shaun-sweet opened this issue Jul 8, 2019 · 3 comments

Comments

@shaun-sweet
Copy link

shaun-sweet commented Jul 8, 2019

Currently the guide has for react components the state type defined up with the props. Instead, I propose its changed to be flipped a bit. For example ->

type ownProps = {}
const initialState = {
  isOpen: false
}

class Modal extends React.Component<ownProps, typeof initialState> {
  state = initialState

this better follows the repositories philosophy of implementation being the source of truth

@piotrwitek
Copy link
Owner

Sounds good, could be added as an alternative approach to the guide in the Class components section.

@shaun-sweet
Copy link
Author

cool, i'll submit a PR

@piotrwitek
Copy link
Owner

@shaun-sweet sure go for it. Please try to keep as much consistency as possible in terms of guide structure and naming/casing conventions across the examples.

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

No branches or pull requests

2 participants