{"id":16293225,"url":"https://github.com/noriste/reactjsday-2018-workshop","last_synced_at":"2026-05-20T05:37:22.719Z","repository":{"id":44598946,"uuid":"151542133","full_name":"NoriSte/reactjsday-2018-workshop","owner":"NoriSte","description":"All the commits made during the 2018 ReactJSDay workshop","archived":false,"fork":false,"pushed_at":"2019-06-03T10:46:09.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-02T20:06:00.173Z","etag":null,"topics":["compound-components","higher-order-component","react-context","reactjs","render-props"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/github/NoriSte/reactjsday-2018-workshop","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NoriSte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-04T08:39:13.000Z","updated_at":"2022-07-11T18:53:33.000Z","dependencies_parsed_at":"2022-08-26T23:41:31.251Z","dependency_job_id":null,"html_url":"https://github.com/NoriSte/reactjsday-2018-workshop","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/NoriSte/reactjsday-2018-workshop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoriSte%2Freactjsday-2018-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoriSte%2Freactjsday-2018-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoriSte%2Freactjsday-2018-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoriSte%2Freactjsday-2018-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NoriSte","download_url":"https://codeload.github.com/NoriSte/reactjsday-2018-workshop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoriSte%2Freactjsday-2018-workshop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268711324,"owners_count":24294762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compound-components","higher-order-component","react-context","reactjs","render-props"],"created_at":"2024-10-10T20:10:35.287Z","updated_at":"2026-05-20T05:37:17.682Z","avatar_url":"https://github.com/NoriSte.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReactJSDay 2018, React Advanced Patterns \u0026 Techniques\nThursday, 4th October 2018\n\n[Link to the training page](https://2018.reactjsday.it/training.html)\n\nTeacher: [@thekitze](https://twitter.com/thekitze)\n\n\nThis repository contains all the commits made during the workshop, below you can find the exercises list.\n\nThe repository contains also my code for the exercises, remember:\n- I know that it could be improved in a lot of ways but it isn't the goal of this repo\n- the exercises are made in an incremental way so I never removed the previous example. In the end, you will find all the exercises together\n- you can see the code running on [CodeSandbox](https://codesandbox.io/s/n4ww24z8lm)\n- the exercises themselves are useful to you only if you attended the workshop with the amazing [@thekitze](https://twitter.com/thekitze)\n\n\n# Exercises\n\n## Higher Order Components\n[Slides](https://slides.reactacademy.io/presentation/higher-order-components/)\n\nex. 1: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/higher-order-components-ex1)\n- Create a HOC called `withMouse`\n- It should send the mouse position (`x` and `y`) to the underlying component as props\n\n\n\nex. 2: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/higher-order-components-ex2)\n- Write a HOC called `measureTime` that will measure the time while a component is mounted\n- This HOC should pass a `secondsPassed` prop to the original component\n\n\n\nex. 3: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/higher-order-components-ex3)\n- Create the `fetchData` HOC.\n- Note that this HOC should also accept an url so you need to create a function that returns a HOC that returns a component… fun right?\n- Fetch real data using `window.fetch`, you can use the Star Wars api: `https://swapi.co/api/people/1`\n- Example usage: `const WrappedApp = fetchData('https://swapi.co/api/people/1')(App);`\n\n\n\n## Render Props\n[Slides](https://slides.reactacademy.io/presentation/render-props/)\n\nex. 1: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/render-props-ex1)\n- Recreate all the HOCs that we made, but using render props.\n- The components should be `FetchData`, `MeasureTime` and `MouseTracker` and they should be in a `components` folder\n- You can use the `render` or the `children` prop, it doesn’t matter.\n- Use all of them in `App.js`\n\n\nex. 2: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/render-props-ex2)\n- Create a `KeyLogger` component that’s gonna use render props\n- Focus the `KeyLogger` component when it mounts (you can use refs for this) and set the `tabIndex` to 0\n- When the user types something, pass `lastKeystroke` and `typedText` to the children\n- Don’t save `Backspace`, `Enter` and `Escape` in the `typedText` prop, but show them in `lastKeystroke`\n- Hint: use `onKeyDown` to capture keyboard events\n- Make sure this component wraps everything in `App`\n\n\n\n## Compound components\n[Slides](https://slides.reactacademy.io/presentation/compound-components/)\n\nex. 1: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/compound-components-ex1)\n- For this exercise you need to create two components: `Select` and `Option`\nUsage:\n- The `Option` component should be a functional component, and it should only receive props: `onSelect`, `children` and `active`\n- The `Select` component should be a compound component, and it should have two states: when it’s opened and closed.\n- You should keep an `opened` property in the state of the `Select` component, but the `Option` component shouldn’t care about it\n- `Select` should accept a `defaultValue` prop which will set the initial value\n- If `Select` is closed, it should display the currently selected `option`\n- When clicking on `Select` it should present all the other options, and the selected `option` should be highlighted\n- When clicking on an `option`, the state should be updated in `Select`\n- To pass the state from `Select` to `Option` you should use the `React.cloneElement()` api\n\n\n\n## Controlled Components\n[Slides](https://slides.reactacademy.io/presentation/controlled-components/)\n\nex. 1: [Download](https://github.com/NoriSte/reactjsday-2018-workshop/releases/tag/controlled-components-ex1)\n- Make the `Select` component controlled.\n- It should accept the following props: `value`, `opened`, `onSelect`, `onOpen`\n- Inside of it, check on every click if the component is controlled or not\n- If the component is controlled, you should just call the callbacks (`onSelect`, `onClick`) etc\n- If the component is not controlled, you should change the state internally\n- If the component is controlled, make sure to compare to the outside props `value` and `opened` instead of comparing to the internal state\n- Keep the state of the Select inside of the `App` component, and just pass it down to `Select` to make it controlled\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoriste%2Freactjsday-2018-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoriste%2Freactjsday-2018-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoriste%2Freactjsday-2018-workshop/lists"}