View App.js
//...
import Logout from './logout';
//...
class App extends Component {
constructor() {
super();
this.state = {
token: null
};
}
View index-edited.js
<Router>
<AppComponent>
<Route exact path="/" component={HomeComponent} />
<Route path="/login" component={LoginComponent} />
<ProtectedRoute path="/admin" component={AdminComponent} />
</AppComponent>
</Router>
View have-to-login.component.js
import React, {Component} from 'react';
import * as firebase from 'firebase';
class HaveToLogginComponent extends Component {
constructor() {
super();
this.state = {
authenticate : false
}
View chat.actions.js
// File : src/actions/chat.actions.js
import {UPDATEMESSAGES} from './actions.type';
export function updateMessage(messages) {
return {
type: UPDATEMESSAGES,
data: {
messages
View init-state.js
// initialisation du state
this.state = {
myText : "", // notre texte
foo : 1 // un nombre quelconque
}