yarn install && yarn start
Open Pure function example subpage.
Reac views use immutability to make components easier to understand and to improve performance. JavaScript classes are not a good representation of an immutable computation. Therefore React allows components to be defined using simple functions.
A pure function component receives props as an argument and must return a React node (JSX).
App
has been reverted to not increase amount of comments at an interval.Comment
has been implemented as a pure function component.CommentForm
has been implemented as a pure function component.CommentList
has been implemented as a pure function component.
All components were added prop validations. Prop validation help to catch
errors in data propagation early in development. They are a poor-man's version
of typing. eslint rules "react/prop-types"
checks that all props are
accompanied by validation. Prop validation is removed when building a
production release.
Check out the components or documentation for examples on how to validate props.
Note that prop validation linting was turned off for the earlier, props and state examples.