Skip to content

Instantly share code, notes, and snippets.

@viceversus
Created January 30, 2016 00:49
Show Gist options
  • Save viceversus/927a8dd2fe3e178d6726 to your computer and use it in GitHub Desktop.
Save viceversus/927a8dd2fe3e178d6726 to your computer and use it in GitHub Desktop.
Entry HoC
import React from 'react';
import UserList from 'user_list';
import PokemonList from 'pokemon_list';
import listWrapper from 'list_wrapper';
$(function() {
function renderList(ListComponent, $domNode) {
var List = listWrapper(ListComponent);
ReactDOM.render(<List />, $domNode[0]);
}
function render() {
var userList = $('#user-list'),
pokemonList = $('#pokemon-list');
if (userList.length > 0) {
renderList(UserList, userList);
}
if (pokemonList.length > 0) {
renderList(PokemonList, pokemonList);
}
}
render();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment