Reading Notes
Does a deployed React application require a server? A server is not explicitly required for deploying a React app.
Why do we prefer to test a React application at the behavior rather than unit level? Unit testing is good for confirming that an algorithm will always produce the desired result, but React apps are created to generate a user experience and it is more crucial that each state is rendered correctly at the correct time.
What does npm run build
do? This command creates a build
directory that houses a production build of the app.
Describe the actual composition/architecture of a React application.
react-i18next
is a library that provides tools for multilingual support/build
directoryBDD Behavior Driven Development, develope based on user behavior
Acceptance Tests Determining whether design requirements have been achieved
function Welcome(props) {return <h1>Hello, {props.name}</h1>}
props
= propertiesclass Welcome extends React.Component { render () { return <h1>Hello, {this.props.name}</h1>; }}
componentDidMount()
runs after a component output is rendered to the DOMcomponentWillUnmount()
teardown an unused elementthis.state.comment = 'Hello';
this.setState({comment: 'Hello'});
<textarea>
tag defines its text as a child, React uses the value attribute<button on Click={activateLasers}> Activate Lasers </button>
setState()
is the only legitimate way to update state after it has been initializedsetState()
should be treated as asynchronousjest-dom
library that adds declarative matchers to jest for use with React
npm i @testing-library/jest-dom