WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/24/2016 09:40:56 PM (3 years ago)
Author:
obenland
Message:

Plugin Directory: WordCamp Boston Contributor Day updates.

  • Separate store creation.
  • Pass SiteHeader component to React Router for navigation links to rerender.
  • Pass default plugins from container component to PluginSection.
  • Basic 404 and no-content handling.

Props sirbrillig.
See #1719.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/index.jsx

    r3701 r3717  
    1 /* global app_data:object */
    21import React from 'react';
    32import { render } from 'react-dom';
    4 import { compose, createStore, applyMiddleware } from 'redux';
    5 import { Provider, connect } from 'react-redux';
    6 import thunkMiddleware from 'redux-thunk';
    7 import { Router, useRouterHistory } from 'react-router';
    8 import { syncHistoryWithStore } from 'react-router-redux';
    9 import { createHistory } from 'history';
    10 import throttle from 'lodash/throttle';
     3import { Provider } from 'react-redux';
    114
    125/**
    136 * Internal dependencies.
    147 */
    15 import reducers from 'reducers';
    16 import routes from 'routes';
    17 import { loadState, saveState } from 'modules/local-storage';
    18 
    19 // Add the reducer to your store on the `routing` key.
    20 const store = compose(
    21     applyMiddleware( thunkMiddleware )
    22 )( createStore )( reducers, loadState() );
    23 
    24 // Save state to local storage when the store gets updated.
    25 store.subscribe( throttle( () => {
    26     saveState( store.getState() );
    27 }, 1000 ) );
    28 
    29 const history = useRouterHistory( createHistory )( {
    30     basename: app_data.base
    31 } );
     8import Router from 'router';
     9import getStore from 'store';
    3210
    3311render(
    34     <Provider store={ store }>
    35         <Router history={ syncHistoryWithStore( history, store ) } routes={ routes } />
     12    <Provider store={ getStore() }>
     13        { Router }
    3614    </Provider>,
    3715    document.getElementById( 'content' )
Note: See TracChangeset for help on using the changeset viewer.