Okay, so I got happily into using React, Redux, Thunk and whatever else there is.
A typical component now looks like this, lifted from the official Redux guide:
import React, { PropTypes } from 'react';
import AppBar from 'material-ui/lib/app-bar';
import FlatButton from 'material-ui/lib/flat-button';
const Titlebar = ({loggedIn, onTitleBarLoginClick}) => (
<AppBar title="Title"
iconElementRight={
<FlatButton label={ loggedIn ? 'Logout' : 'Login' }
onTouchTap={ e => onTitleBarLoginClick(e) }
/>
}
/>
);
Titlebar.propTypes = {
loggedIn: PropTypes.bool.isRequired,
onTitleBarLoginClick: PropTypes.func.isRequired
};
export default Titlebar
Now, here’s the thing: Some of my components will use external libraries to manipulate the DOM (for example, a drawing tool using SVG) so I’ll need React’s ComponentDidMount()
So, is there some way I can keep using the above or do I need to go back to React.createClass()
?