Skip to content

Instantly share code, notes, and snippets.

@krawaller
krawaller / LegoSetImage.js
Last active Nov 2, 2020
Redux useSelector and useDispatch hook test example
View LegoSetImage.js
import React, { FunctionComponent } from "react";
import { useSelector, useDispatch } from "react-redux";
import { selectCurrentSet, zoomImage } from "../dataLayer";
export const LegoSetImage: FunctionComponent = () => {
const set = useSelector(selectCurrentSet);
const dispatch = useDispatch()
const zoomHandler = () => dispatch(zoomImage(set.set_img_url))
return (
<div className="legoSetImageContainer">
View team_picker.rb
#!/usr/bin/env ruby
class Manager
def pick_a_team(squad)
team = Team.new
# get the best players for every position from the squad
# and add them to the team
# for every position (goalkeeper etc)
# get the best player(s) from the squad
You can’t perform that action at this time.