Git Product home page Git Product logo

preact-redux-example's Introduction

Preact Redux Example

A 9kb Preact + Redux boilerplate built with Preact CLI, implementing a To-Do List app.

As of v2, now wonderfully simplified via preact-redux (no more preact-compat!).


Quick-Start Guide

Installation

1. Clone this repo:

git clone https://github.com/developit/preact-redux-example.git my-app
cd my-app

2. Make it your own:

rm -rf .git && git init && npm init

ℹī¸ This re-initializes the repo and sets up your NPM project.

3. Install the dependencies:

npm install

You're done installing! Now let's get started developing.

Development Workflow

4. Start a live-reload development server:

PORT=8080 npm run dev

This is a full web server nicely suited to your project. Any time you make changes within the src directory, it will rebuild and even refresh your browser.

5. Generate a production build in ./build:

npm run build

You can now deploy the contents of the build directory to production!

Example: deploy to surge.sh:

npm i surge && surge build -d my-app.surge.sh


Structure

Apps are built up from simple units of functionality called Components. A Component is responsible for rendering a small part of an application, given some input data called props, generally passed in as attributes in JSX. A component can be as simple as:

class Link extends Component {
  render({ to, children }) {
    return <a href={ to }>{ children }</a>;
  }
}
// usage:
<Link to="/">Home</Link>

License

MIT

preact-redux-example's People

Contributors

developit avatar robinvdvleuten avatar vaneenige 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

preact-redux-example's Issues

with rollup

i have an example of this with rollup if you're interested

Redundant dependencies?

Might have missed some but, if I'm not mistaking, the following packages are redundant.
Not sure if you left them there for boiler purposes though

[email protected]:27
Since you only use es2015-minimal

[email protected]:53 and [email protected]:56
Because you never seem to use anything from the react package

[email protected]:54
Never used

Also, kind of off topic, regarding the last one; I've tried to implement redux in my own preact app with react-redux and preact-router, but the Provider component is complaining about its children, which are the Router component with its children:

invariant.js:38Uncaught Invariant Violation: onlyChild must be passed a children with exactly one child.
    invariant @ invariant.js:38
    onlyChild @ onlyChild.js:29
    render @ Provider.js:53
    hook @ preact.js:65
    renderComponent @ preact.js:379
    createComponentFromVNode @ preact.js:44
    8buildComponentFromVNode @ preact.js:435
    diff @ preact.js:226
    render @ preact.js:478
    80../config/routes @ index.js:24
    s @ _prelude.js:1
    e @ _prelude.js:1
    (anonymous function) @ _prelude.js:1

Any clue?

An example including async API call?

I know there are so many options for async redux, but would be nice to have an example of making an async API call using redux-promise-middleware or redux-saga or whatever is the most straight forward option.

Thanks in advance!

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.