Setting up PropTypes
Include the prop-types
package:
npm install --save prop-types
In code on the class file, add (outside the class, but before the export default
):
<class_name>.propTypes = {
<prop_name>: PropTypes.string.isRequired // Example
};
ReactJS setup (unique CSS)
Once you have ejected the project, edit the webpack.config.dev.js
file. Search for test: /\.css$/
. Under the the use >> options
property add the following under the importLoaders: 1,
:
modules: true,
localIdentName: '[name]__[local]__[hash:base64:5]'
This allows for setting up unique CSS class names when multiple components are used that might use a similarly named CSS class style.
Install ReactJS Windows
Install NodeJS and NPM:
Go to https://nodejs.org/en/
Download latest version of NodeJS LTS with Administrator privileges.
Install Visual Studio Code:
Go to https://code.visualstudio.com/
Downloaded latest version.
Run VS Code.
It should recommend to install Git. Follow instructions to install Git for Windows.
After installation, should be able to get version of git.
Open terminal and type:
git --version
Followed by:
node --version
Followed by:
npm --version
Each should give versions installed on Windows.
...