sandstorm / typescript-react-app-kickstart-guide Goto Github PK
View Code? Open in Web Editor NEWKickstart guide for React Redux Apps written in TypeScript
License: MIT License
Kickstart guide for React Redux Apps written in TypeScript
License: MIT License
currently default props are defined with
export type PickDefaultProps<Props, defaultPropsKeys extends keyof Props> = Readonly<Required<{
[P in defaultPropsKeys]: Props[P]
}>>;
and used like
type DefaultProps = PickDefaultProps<ButtonProps, 'state' | "size">;
why not do:
type DefaultProps = Partial<ButtonProps>;
using the built in Partial
type?
All the best, Sebastian
Currently this guide covers no solution for routing.
... when react-scripts-ts
upgraded to create-react-app 2.x.
Add a CI script to automatically update the gh-pages branch when master is updated.
With CRA 2.0, you need to add TS Loader to storybook; and use jsx=react as parameter.
I can push a full example later :)
create-react-app
now supports TypeScript out of the box. No need to use react-scripts-ts
.
We can define mapStateToProps
more concise as follows:
current:
const mapStateToProps = (dispatch: Dispatch) => ({
action: (someArg: SomeType) => dispatch(actionCreator(someArg)),
)};
wanted:
const mapStateToProps = {
action: actionCreator,
};
redux's connect
will automatically wrap every actionCreator function with the dispatch
. So we end up with the same result with less repetitive code.
reference: https://github.com/reduxjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.