Commit 327648b3 authored by Turid Cecilie Dahl's avatar Turid Cecilie Dahl
Browse files

Fixed fetching fav

parent cbed675d
import React from 'react';
import MiddlePart from './components/MiddlePart';
import Header from './components/header';
import Sidebar from './components/Sidebar';
import './App.css';
function App() {
......@@ -11,10 +10,6 @@ function App() {
<Header/>
</div>
<MiddlePart/>
<div className="sidebar">
<Sidebar/>
</div>
<button onClick={getCollection}>Click meeee!</button>
</div>
);
}
......
......@@ -38,6 +38,7 @@ class MiddlePart extends React.Component{
}
this.changeContent = this.changeContent.bind(this);
this._updateIndex = false;
this._fetchFav = false;
}
//--------------------------------------------------------------------------------------------------------------------------------------
......@@ -68,6 +69,7 @@ class MiddlePart extends React.Component{
imageIndex: localStorage.favImage,
textIndex: localStorage.favText
});
this._fetchFav = true;
}
}
//--------------------------------------------------------------------------------------------------------------------------------------
......@@ -131,7 +133,11 @@ class MiddlePart extends React.Component{
if (this._updateIndex){
this.changeContent()
}
if(this._fetchFav){
this.changeContent();
}
this._updateIndex = false;
this._fetchFav = false;
}
componentWillUnmount() {
......
......@@ -43,7 +43,7 @@ class Sidebar extends Component {
<h5>Sounds</h5>
<form>
<label>
<input type="radio" value="animals"
<input type="radio" value="animals"
checked={this.props.soundIndex === 'animals'}
onChange={this.props.handleOptionChangeSound} />
Animals
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment