Live data from Hacker News

Ask HN: Go-to web stack today?

news.ycombinator.com

431–440 of 453 posts

Re: Ask HN: Go-to web stack today?

#431

Earlier quoted context omitted.

I urgently encourage you and anyone else reading this to check out Turbolinks 5, ideally in tandem with Stimulus. https://www.youtube.com/watch?v=SWEts0rlezA&t=3m22s https://github.com/turbolinks/turbolinks https://stimulusjs.org/ You can get all of the benefits of server-generated pages with the speed of an SPA. 90%+ of the sites built using SPAs would be better served by Turbolinks and Stimulus.

This all looks really nice - any idea if there's anything comparable that works with Django?

Turbolinks has out-of-the-box support for Rails, but should theoretically work with any backend without much work. Just install via npm.

Re: Ask HN: Go-to web stack today?

#432
post #297

Earlier quoted context omitted.

If that’s the argumentation then Postgres is over 22 years old which makes it over two times better? On the other hand Windows is over 30 years old and it still hasn’t fixed many issues which for me are the reasons why I don’t want to have anything to do with it.

I'm not saying MongoDB is better because it is old, and I was rather hoping you would elaborate. For all I know, you could have had issues with it yesterday or 9 years ago.

I haven't tried it in 4 years myself. But I invested in a company that just launched their product two months ago and already regrets building it on Mongo.

Re: Ask HN: Go-to web stack today?

#433

Earlier quoted context omitted.

I urgently encourage you and anyone else reading this to check out Turbolinks 5, ideally in tandem with Stimulus. https://www.youtube.com/watch?v=SWEts0rlezA&t=3m22s https://github.com/turbolinks/turbolinks https://stimulusjs.org/ You can get all of the benefits of server-generated pages with the speed of an SPA. 90%+ of the sites built using SPAs would be better served by Turbolinks and Stimulus.

This all looks really nice - any idea if there's anything comparable that works with Django?

Stimulus will work with any (or no) backend.

Turbolinks will work great with Django, but I recommend configuring your stack to automate the inclusion of the Turbolinks-Location header in your responses.

I just did a quick Google and this came up: https://stackoverflow.com/questions/47240766/to-use-turbolin...

Let us know how you make out!

Re: Ask HN: Go-to web stack today?

#434

Earlier quoted context omitted.

I urgently encourage you and anyone else reading this to check out Turbolinks 5, ideally in tandem with Stimulus. https://www.youtube.com/watch?v=SWEts0rlezA&t=3m22s https://github.com/turbolinks/turbolinks https://stimulusjs.org/ You can get all of the benefits of server-generated pages with the speed of an SPA. 90%+ of the sites built using SPAs would be better served by Turbolinks and Stimulus.

I've never heard of either before, and they've really caught my attention. Thanks for bringing this up.

Let me know if you need any help getting up and running. I'm not involved but I'm a big fan.

For what it's worth, if you are impressed by the reasoning and design-thinking that created these libraries, I encourage you to try Rails sometime as well. I still consider it the best way to build a web application for 90% of use cases. I'm happy to answer any questions you might have.

https://www.quora.com/Why-do-so-many-startups-use-Ruby-on-Ra...

Re: Ask HN: Go-to web stack today?

#436
post #366

Earlier quoted context omitted.

I'm not exactly clear on what you're looking for. Reducers, by definition, take two parameters: the current state and the action. They should return an updated state based on those two inputs only. The `payload` field is simply a common convention for consistently putting the "arguments" or "data" for that action type at a known key in the action each time. I'm also not sure what you mean by "calling actions should w…

Look at the sample code in https://redux-starter-kit.js.org/api/createslice Since all actions contain just one parameter, it's easy to confuse things, so let's add a multiplyAdd function to multiply the counter by 'a' and then add 'b'. It would look like this: multiplyAdd: (state, action) => state * action.payload.a + action.payload.b I want it to look like: multiplyAdd: (state, a, b) => state * a + b or even multipl…

You can do what you want just in 17 lines of pure JavaScript. This is an example:

  const

  create_store = ({state, actions}) => {
    const

    after_update_do = [],

    subscribe = fn => after_update_do.push(fn),

    notify = () => after_update_do.forEach(fn => fn(state)),

    create_action = action => (...args) => {
      state = action(state, ...args);
      notify()
    };

    return Object.entries(actions).reduce((bound_actions, [action_name, action]) => 
      Object.assign({}, bound_actions, {[action_name]: create_action(action)}), 
      {subscribe})
  },

  counter = create_store({
    state: 0,
    actions: {
      increase: state => state + 1,
      
      decrease: state => state - 1,

      multiply_add: (state, a, b) => state * a + b,
    },
  });

  counter.subscribe(state => console.log('First reactive component was updated with: ' + state));
  counter.subscribe(state => console.log('Second reactive component was updated with: ' + state));

Now you can call all actions directly from the counter and update all components in reactive manner.

  counter.increase();
  // First reactive component was updated with: 1
  // Second reactive component was updated with: 1

  counter.multiply_add(2, 3)
  // First reactive component was updated with: 5
  // Second reactive component was updated with: 5
Post reply on HN