Skip to content

Instantly share code, notes, and snippets.

@astoilkov
astoilkov / readme.md
Last active March 13, 2024 10:19
Async Operations with useReducer Hook

Async Operations with useReducer Hook

9 March, 2019

We were discussing with @erusev what we can do with async operation when using useReducer() in our application. Our app is simple and we don't want to use a state management library. All our requirements are satisfied with using one root useReducer(). The problem we are facing and don't know how to solve is async operations.

In a discussion with Dan Abramov he recommends Solution 3 but points out that things are fresh with hooks and there could be better ways of handling the problem.

Problem

@st0012
st0012 / taipei_list.md
Last active July 27, 2019 15:45
Things to visit in Taipei

Places to go

  • Taipei 101
  • Tamsui
  • National Palace Museum
  • Shi-men Ting

Nigh markets

  • Tonghua Night Market - my favorite
    • There are some great bars nearby!
@amirrajan
amirrajan / main.rb
Last active September 30, 2020 19:02
DragonRuby collision and physics
def tick args
# initialization
args.state.x ||= 620
args.state.y ||= 700
args.state.dy ||= 0
args.state.dx ||= 25
args.state.gravity = -0.5
args.state.drag_coeff = 0.05
args.state.walls = [
[0, 0, 1280, 100],