Git Product home page Git Product logo

react-hn's Introduction

React Hacker News Example

See this application live at: https://react-hn.kristoferbaxter.com

This is an example of a PWA built using React, Webpack, and some small opinions. Please do not think of this as the way to build your application. Instead, view this as an example of some concepts used in modern web applications (sw, h2, h2push).

Made with kindness in California. πŸ„

Installation

  1. Install yarn
  2. Install h2o Proxy (to allow for local h2 and h2 push)
    • Depends on your OS. Tend to use 'brew' on MacOS -- 'brew update; brew install h2o'
  3. Install Brotli and Zopfli CLI
  4. Install Yarn Dependencies
    • yarn install
  5. Run Locally
    • yarn start (chrome only)
    • yarn bundle:prod; yarn start (all browsers)
  6. Access using your favorite browser

Details

I've focused mostly on first initial load performance, with the small caveat of using Webpack instead of Rollup. I'd like the route based code splitting to provide a extensible model for keeping initial view rendering costs low.

In the future there are plenty of things to do:

  1. Move away from needlessly spamming the Firebase API (see src/restify/storage/*) and instead leverage the firebase client in the node server.
  2. Write a Webpack plugin to allow for split css files based on packages.
  3. Internationalization/Localization, including RTL layout.
  4. Support AppCache (even though it's kind of a jerk)
  5. Allow for posting comments!
  6. FIX LOTS OF BUGS! ZOMG SO MANY BUGS!

react-hn's People

Contributors

kristoferbaxter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-hn's Issues

Navigation for / and /top/:page should highlight the "top" tab in header

I don't see a way to pass a custom method to <NavLink> from React-Router for denoting it's active classes.

Idea 1:
Use a custom <Match> component to derive when either url pattern is matched and apply via standard classNames

Idea 2:
Modify React-Router to accept custom methods for determining active states.

Idea 3:
Move away from React-Router entirely and implement a custom router. (Likely don't have time for this).

Rollup.js example

Do you have any example of code and CSS splitting with rollup?

Thks in advance

Hosted version is down

Hi! Looks like the hosted version of this isn’t loading and is instead throwing a cloud flare issue page

Debugging Code in Prod Build

I am slightly unfamiliar with current react versions, but noticed a few artifacts in the prod build worth chasing down.

    "use strict";
    t.exports = function(u) {
        for (var h = arguments.length - 1, g = "Minified React error #" + u + "; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=" + u, v = 0; v < h; v++)
            g += "&args[]=" + encodeURIComponent(arguments[v + 1]);
        g += " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
        var N = new Error(g);
        throw N.name = "Invariant Violation",
        N.framesToPop = 1,
        N
    }
}```

I wouldn't expect this to appear in the production minified version. I believe something is amiss with Babili + Webpack as used.

minor visual suggest: overflow-y: scroll to the body?

While there are no elements in the list, the about text is jumping from left to right and back. Have you considered to add a simple overflow-y: scroll; to the body? In most cases the list is filled with data anyway.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.