Skip to content

Instantly share code, notes, and snippets.

@DreySkee
DreySkee / views.js
Last active February 5, 2017 19:17
13 - Wordpress API + ReactJS
export default {
'home': './components/Home.js',
'about': './components/About.js'
};
@DreySkee
DreySkee / index.js
Last active February 1, 2017 23:59
12 - Wordpress API + ReactJS
import React from 'react';
import {render} from 'react-dom';
import App from './components/App.js';
import Home from './components/Home.js';
import {
browserHistory,
IndexRoute,
Redirect,
Route,
@DreySkee
DreySkee / Home.js
Created January 31, 2017 00:41
11 - Wordpress API + ReactJS
import React from 'react';
import DataStore from './../stores/DataStore.js';
class Home extends React.Component {
render() {
let allData = DataStore.getAll();
console.log(allData);
return (
@DreySkee
DreySkee / index.js
Last active January 31, 2017 00:28
10 - Wordpress API + ReactJS
import React from 'react';
import {render} from 'react-dom';
import App from './components/App.js';
import Home from './components/Home.js';
import DataActions from './actions/DataActions.js';
import {
browserHistory,
IndexRoute,
Redirect,
@DreySkee
DreySkee / DataStore.js
Last active January 31, 2017 00:23
9 - Wordpress API + ReactJS
import alt from './../alt/alt.js';
import DataActions from './../actions/DataActions.js';
class DataStore {
constructor() {
this.data = {};
this.bindListeners({
// Listen to the getSuccess() in DataActions.js
handleSuccess: DataActions.GET_SUCCESS
@DreySkee
DreySkee / DataActions.js
Last active February 18, 2020 10:27
8 - Wordpress API + ReactJS
import axios from 'axios';
import alt from './../alt/alt.js';
class DataActions {
constructor() {
const appUrl = 'http://wordpress-installation-example-url.com'; // Replace this with your WP installation url
this.pagesEndPoint = `${appUrl}/wp-json/wp/v2/pages`; // Endpoint for getting Wordpress Pages
this.postsEndPoint = `${appUrl}/wp-json/wp/v2/posts`; // Endpoint for getting Wordpress Posts
@DreySkee
DreySkee / Alt.js
Created January 31, 2017 00:12
7 - Wordpress API + ReactJS
import Alt from 'alt';
const alt = new Alt();
export default alt;
@DreySkee
DreySkee / Home.js
Created January 31, 2017 00:11
6 - Wordpress API + ReactJS
import React from 'react';
class Home extends React.Component {
render() {
return (
<div>
<h1>Hello World</h1>
</div>
);
@DreySkee
DreySkee / App.js
Created January 31, 2017 00:09
5 - Wordpress API + ReactJS
import React from 'react';
export default class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
@DreySkee
DreySkee / index.js
Last active January 31, 2017 00:06
4 - Wordpress API + ReactJS
import React from 'react';
import {render} from 'react-dom';
import App from './components/App.js';
import Home from './components/Home.js';
import {
browserHistory,
IndexRoute,
Redirect,
Route,