forked from tanner/qotnews
Cache articles in memory for speed
This commit is contained in:
@@ -8,8 +8,13 @@ class Article extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
const id = this.props.match.params.id;
|
||||
const cache = this.props.cache;
|
||||
|
||||
if (id in cache) console.log('cache hit');
|
||||
|
||||
this.state = {
|
||||
story: false,
|
||||
story: cache[id] || false,
|
||||
error: false,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user