How to use Google fonts in React.js?

In some sort of main or first loading CSS file, just do: @import url(‘https://fonts.googleapis.com/css?family=Source+Sans+Pro:regular,bold,italic&subset=latin,latin-ext’); You don’t need to wrap in any sort of @font-face, etc. the response you get back from Google’s API is ready to go and lets you use font families like normal. Then in your main React app JavaScript, at the top … Read more

react-router vs react-router-dom, when to use one or the other?

react-router contains all the common components between react-router-dom and react-router-native. When should you use one over the other? If you’re on the web then react-router-dom should have everything you need as it also exports the common components you’ll need. If you’re using React Native, react-router-native should have everything you need for the same reason. So … Read more

How to use comments in React

Within the render method comments are allowed, but in order to use them within JSX, you have to wrap them in braces and use multi-line style comments. <div className=”dropdown”> {/* whenClicked is a property not an event, per se. */} <Button whenClicked={this.handleClick} className=”btn-default” title={this.props.title} subTitleClassName=”caret”></Button> <UnorderedList /> </div> You can read more about how comments … Read more