{"@attributes":{"version":"2.0"},"channel":{"title":"DEV Community: SPeshov","description":"The latest articles on DEV Community by SPeshov (@speshov).","link":"https:\/\/dev.to\/speshov","image":{"url":"https:\/\/media2.dev.to\/dynamic\/image\/width=90,height=90,fit=cover,gravity=auto,format=auto\/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F199146%2Fe23ebec9-5719-40c7-9aaa-5cf9e7a744b1.png","title":"DEV Community: SPeshov","link":"https:\/\/dev.to\/speshov"},"language":"en","item":[{"title":"Choosing React Design System \/Component Library","pubDate":"Sat, 01 Aug 2020 15:14:57 +0000","link":"https:\/\/dev.to\/speshov\/choosing-react-design-system-component-library-2pjl","guid":"https:\/\/dev.to\/speshov\/choosing-react-design-system-component-library-2pjl","description":"<blockquote>\n<p>What's your experience and what do you use? <\/p>\n<\/blockquote>\n\n<p>Today I've decided to set up my UI design system, do a short research on what would be <br>\nright fit for my use case and once install do a small example.<\/p>\n\n<p>Checkboxes I wanted to fill:<\/p>\n\n<ol>\n<li><p>it's easily compatible with <code>styled-components<\/code><\/p><\/li>\n<li><p>have a wide react UI  ready to use components library<\/p><\/li>\n<li><p>it's easy to tweak CSS styles of  #2 (preferably with <code>styled-components<\/code>)<\/p><\/li>\n<\/ol>\n\n<p>I've stumbled upon a lot of react component libraries but only these ones <br>\nmade happy and they left in the last decision steps.<\/p>\n\n<h1>\n  \n  \n  <a href=\"https:\/\/styled-components.com\/\">Just use styled-components<\/a>\n<\/h1>\n\n<p>This was my first choice I prefer this one over the others, but I don't want to spend time designing my own it will be just a waste of time. <br>\nI would love to have one but I want to build it over time while I'm working on a project.<\/p>\n\n<p>Also, I plan to use <code>styled-component<\/code> to overwrite styles of the below whatever UI libraries I choose from. Meaning that I won't import components from below libraries, instead, I will wrap them around styled component and export that. <\/p>\n\n<h1>\n  \n  \n  <a href=\"https:\/\/ant.design\/\">Ant.Design <\/a>\n<\/h1>\n\n<p>I liked the design of this one clean, simple, beautiful. A lot of components to choose from and the documentation were just amazing with a wide range of examples.<\/p>\n\n<p>I was ready to go with this one, but then I heard that voice in my mind \ud83d\ude43 \"Search up for style overwrites with styled comp.\" its a good practice to do that and it can save you some time. Just search for issues for whatever package you might use \ud83d\ude04.<\/p>\n\n<p>And there was some tricky integration with styled-components that I found and it did not work all of the time for some components from <a href=\"http:\/\/ant.design\">ant.design<\/a> - so I decided to continue with my search.<\/p>\n\n<h1>\n  \n  \n  <a href=\"https:\/\/styled-components.com\/\">Material-UI<\/a>\n<\/h1>\n\n<p>Oh, this one \u261d\ufe0f - it's ok. if I was looking for something like this 3 years back I would choose this one but now I just don't like the look of it. One thing that makes me have look at it once again is that I see a lot of people praise it. Will see - still don't like it \ud83d\ude01.<\/p>\n\n<h1>\n  \n  \n  <a href=\"https:\/\/reach.tech\/\">Reach-UI<\/a>\n<\/h1>\n\n<p>I'm using this one in a big project and it works great with <code>styled-components<\/code> we have e UI\/UX <br>\nsenior dev that it's working on our UI library in combination with other react components and it works great. But once again it takes time so setup different components and I don't want to waste time on something that I can have easily (example ant.design) <\/p>\n\n<p>This one is light and that's one thing that I can't say about the <a href=\"http:\/\/ant.design\">ant.design<\/a>  <\/p>\n\n<p>There is one interesting library that I found Bit, it will extract component library from some of your projects and you can use it later one. I plan to try this one later on when I have built some of my components libraries.<\/p>\n\n<h1>\n  \n  \n  Conclusion\n<\/h1>\n\n<p>Not decided yet - I've spent so much time researching and trying examples and can't decide yet.<\/p>\n\n<blockquote>\n<p>What's your experience and what do you use?<\/p>\n<\/blockquote>\n\n"},{"title":"Dev Life: Honest development struggle of mine.","pubDate":"Wed, 29 Jul 2020 20:31:05 +0000","link":"https:\/\/dev.to\/speshov\/dev-life-honest-development-struggle-of-mine-45dk","guid":"https:\/\/dev.to\/speshov\/dev-life-honest-development-struggle-of-mine-45dk","description":"<p>I'm not sure how to start this post but the main point that I want to get to is the fact that Me as a web developer I struggling with keeping up to that with all new technologies that popup up around development JavaScript apps.<\/p>\n\n<p>There are times when I feel pretty confident about starting a project and then right before I start working on it I start with searching for the new greatest, best tech stack for it,  so I can at the same time learn new technology and have a product at the end.<\/p>\n\n<p>And this never ends well. You end up stuck with some tutorial where you can't replicate the example that the tutorial mentor did, or you just end up more confused.<\/p>\n\n<p>Also, some docs of these new technologies are never complete and they don't offer enough real-world examples - don't get me wrong they have working examples but they are just not applicable in a real-world application. <\/p>\n\n<p>And yes I know what you might be thinking \"you need to work your way up\" - yes but before I start I feel that imposter syndrome kicking and I get that feeling that I might not be good enough and I feel stupid even that I have 5+ year experience in web dev.<\/p>\n\n<p>Whatever the scenario development it's not easy, as that is projected from more experienced devs on us. For example when you watch a tutorial on something and you see that dev writing like insane and everything is working just as intended, and there is no thinking on how to approach some given problem they just do it - when in reality they have practiced that before and they just executed that on video and you end up frustrated.  \ud83d\ude05<\/p>\n\n<p>It takes time to learn and get comfortable with new technology and then start using it with confidence.<\/p>\n\n<p>And this is a never-ending cycle - I don't mind if - I have patience, but when I realize that it can take me for example 3 days to set up a production-ready project (not just with create react app) with workflows and what not it annoys me.<\/p>\n\n<p>So I've decided to update my website and then I will set up production-ready starters\/boilerplate projects with most common technologies that I think will need in the future, so I don't need to waste time setting up projects  from the start, because all of them are pretty much the same you need authentication, authorization, routing, some basic styles, maybe social login,<\/p>\n\n<p>And I'm sorry for this depressing log \ud83d\ude03 but this is just a reality of mine and I just wanted to share it.<\/p>\n\n"},{"title":"How to setup GatsbyJS starter with Typescript, ESLint, Prettier","pubDate":"Wed, 23 Oct 2019 22:13:43 +0000","link":"https:\/\/dev.to\/speshov\/how-to-setup-gatsbyjs-starter-with-typescript-eslint-prettier-4jh3","guid":"https:\/\/dev.to\/speshov\/how-to-setup-gatsbyjs-starter-with-typescript-eslint-prettier-4jh3","description":"<p>Original post <a href=\"https:\/\/medium.com\/@stojanpeshov\/how-to-setup-gatsbyjs-starter-with-typescript-eslint-prettier-269b1a0a812f\" rel=\"noopener noreferrer\">Here<\/a> - with images \ud83d\ude05<\/p>\n\n<h2>\n  \n  \n  In Short\n<\/h2>\n\n<ol>\n<li>Fork, clone and install the Gatsby default starter<\/li>\n<li>Install <code>gatsby-plugin-typescript<\/code> and <code>TypeScript<\/code>\n<\/li>\n<li>Configure <code>tsconfig.json<\/code> and  <code>type-check script<\/code>\n<\/li>\n<li>Converting files to TypeScript<\/li>\n<li>Setting up  <code>ESLint<\/code> &amp; <code>Prettier<\/code>\n<\/li>\n<li>Setting up VSC<\/li>\n<\/ol>\n\n<h2>\n  \n  \n  1. Clone and install the Gatsby default starter\n<\/h2>\n\n<p>So yes just fork the Gatsby default starter to your own Github account and clone it to your local machine from there.<\/p>\n\n<ul>\n<li>Go to <a href=\"https:\/\/github.com\/gatsbyjs\/gatsby-starter-default\" rel=\"noopener noreferrer\">https:\/\/github.com\/gatsbyjs\/gatsby-starter-default<\/a>\n<\/li>\n<li>Clone the repository to your local machine with\u00a0<code>git clone git@github.com:gatsbyjs\/gatsby-starter-default.git<\/code>\n<\/li>\n<li>\n<code>cd<\/code>\u00a0into the folder<\/li>\n<li>Run\u00a0<code>npm install<\/code>\n<\/li>\n<li>Run\u00a0<code>npm run develop<\/code>\n<\/li>\n<\/ul>\n\n<p><a href=\"https:\/\/media.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwh82n6tx0jdhq2ekv3a0.png\" class=\"article-body-image-wrapper\"><img src=\"https:\/\/media.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwh82n6tx0jdhq2ekv3a0.png\" alt=\"Alt Text\"><\/a><\/p>\n\n<p>And you are done with setting you your Gatsby starter and it's running , on\u00a0<code>http:\/\/localhost:8000\/<\/code>\u00a0and we can start to set-up TypeScript now!<\/p>\n\n<h2>\n  \n  \n  2. Install <code>TypeScript<\/code> &amp; <code>gatsby-plugin-typescript and<\/code>\n<\/h2>\n\n<p>TypeScript can be added to the\u00a0<code>devDependencies<\/code>\u00a0whilst Gatsby plugins should be added as a dependency:<\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>npm install gatsby-plugin-typescript &amp; npm install typescript --save-dev\n<\/code><\/pre>\n\n<\/div>\n\n<p><a href=\"https:\/\/www.notion.so\/bf6fd33fbce24c5db30234a2d6bf2b98#50645bc2e9404ec3b72bc3cd6843dad9\" rel=\"noopener noreferrer\"><\/a><\/p>\n\n<p>And we need to enable the plugin <code>gatsby-plugin-typescript<\/code> in the <code>gatsby-config.js<\/code> file in the root of your project.<\/p>\n\n<p><a href=\"https:\/\/www.notion.so\/bf6fd33fbce24c5db30234a2d6bf2b98#3c21168338854e4a85ece51b9b554254\" rel=\"noopener noreferrer\"><\/a><\/p>\n\n<h2>\n  \n  \n  3. Add and configure <code>tsconfig.json<\/code>\n<\/h2>\n\n<p>Our config file should look something like this:<\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"target\": \"esnext\",\n    \"jsx\": \"preserve\",\n    \"lib\": [\"dom\", \"esnext\"],\n    \"strict\": true,\n    \"noEmit\": true,\n    \"isolatedModules\": true,\n    \"esModuleInterop\": true,\n    \"noUnusedLocals\": false\n  },\n  \"exclude\": [\"node_modules\", \"public\", \".cache\"]\n}\n<\/code><\/pre>\n\n<\/div>\n<h2>\n  \n  \n  4. <strong>Converting files to TypeScript<\/strong>\n<\/h2>\n\n<p>Start renaming \u00a0<code>*.js<\/code>\u00a0files to\u00a0<code>*.ts<\/code>\u00a0and\u00a0<code>*.tsx<\/code>\u00a0(if they contain JSX). <\/p>\n\n<p>We will need fixing the current type errors that TypeScript is screaming at us. I\u2019m leaving the actual fixing of these errors for the follow-up blog post. For now, please bear with me as we set-up a linter.<\/p>\n\n<p><a href=\"https:\/\/www.notion.so\/bf6fd33fbce24c5db30234a2d6bf2b98#3e3d44333bb6404a9b74cfe7dab26ef5\" rel=\"noopener noreferrer\"><\/a><\/p>\n<h2>\n  \n  \n  5. <strong>Setting up ESLint and Prettier<\/strong>\n<\/h2>\n\n<p>To set up ESLint with TypeScript, Prettier and some React best practices, we\u2019ll need to add a bunch of\u00a0<code>devDependencies<\/code>:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>npm install eslint @typescript-eslint\/eslint-plugin @typescript-eslint\/parser eslint-config-prettier eslint-plugin-prettier eslint-plugin-react --save-dev\n<\/code><\/pre>\n\n<\/div>\n\n<p>And after all packages are installed, let's add a <code>.eslintrc.js<\/code>  file in the root of the  project. Example of  ESLint configuration:<\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>module.exports = {\n  parser: '@typescript-eslint\/parser', \/\/ Specifies the ESLint parser\n  extends: [\n    'eslint:recommended',\n    'plugin:react\/recommended',\n    'plugin:@typescript-eslint\/recommended',\n    'prettier\/@typescript-eslint',\n    'plugin:prettier\/recommended'\n  ],\n  settings: {\n    react: {\n      version: 'detect'\n    }\n  },\n  env: {\n    browser: true,\n    node: true,\n    es6: true\n  },\n  plugins: ['@typescript-eslint', 'react'],\n  parserOptions: {\n    ecmaFeatures: {\n      jsx: true\n    },\n    ecmaVersion: 2018, \/\/ Allows for the parsing of modern ECMAScript features\n    sourceType: 'module' \/\/ Allows for the use of imports\n  },\n  rules: {\n    'react\/prop-types': 'off', \/\/ Disable prop-types as we use TypeScript for type checking\n    '@typescript-eslint\/explicit-function-return-type': 'off'\n  },\n  overrides: [\n    \/\/ Override some TypeScript rules just for .js files\n    {\n      files: ['*.js'],\n      rules: {\n        '@typescript-eslint\/no-var-requires': 'off' \/\/\n      }\n    }\n  ]\n};\n<\/code><\/pre>\n\n<\/div>\n\n<p><strong>Adding Lint Scripts<\/strong><\/p>\n\n<p>To make life easier on ourselves we\u2019ll add two lint scripts to our\u00a0<code>package.json<\/code><\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\"scripts\": {\n  ...\n  \"lint\": \"eslint --ignore-path .gitignore . --ext ts --ext tsx --ext js --ext jsx\",\n}\n<\/code><\/pre>\n\n<\/div>\n\n<p>Once called it will run on every <em>`.ts,<\/em>.js,*.tsx and *.jsx` file and shows you the errors.<\/p>\n\n<h2>\n  \n  \n  6. <strong>Setting up the editor<\/strong>\n<\/h2>\n\n<p>Add this <\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\"eslint.validate\": [\n    {\n      \"language\": \"javascript\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"javascriptreact\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"typescript\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"typescriptreact\",\n      \"autoFix\": true\n    }\n  ],\n<\/code><\/pre>\n\n<\/div>\n\n<p>To your general <code>settings.json<\/code><\/p>\n\n<p><a href=\"https:\/\/www.notion.so\/bf6fd33fbce24c5db30234a2d6bf2b98#6350093e82b047c8aea9d82ad98498f0\" rel=\"noopener noreferrer\"><\/a><\/p>\n\n<p>We also need to install  type definitions for our packages but I will leave that for you, just google it and you will get the general idea.<\/p>\n\n<p>I hope that this post gave you a basic idea on how to do the initial setup of GatsbyJS + Typescript + ESLint + Prettier<\/p>\n\n","category":["gatsby","react","javascript","typescript"]},{"title":"Using Hook inside initialize state function() in useReducer() Hook","pubDate":"Tue, 22 Oct 2019 19:55:46 +0000","link":"https:\/\/dev.to\/speshov\/using-hook-inside-initialize-state-function-in-usereducer-hook-3h14","guid":"https:\/\/dev.to\/speshov\/using-hook-inside-initialize-state-function-in-usereducer-hook-3h14","description":"<p>So I had this issue with using <code>Hook<\/code> inside <code>Initialize Function<\/code> of react <code>useReducer Hook<\/code>, as a third argument to it.<\/p>\n\n<p>And the problem is that I was getting <\/p>\n\n<p><a href=\"https:\/\/www.notion.so\/0ed4f6238f81452fb2363a9f62e98b68#138bf08975fa4730b3bbd356f8f3b903\"><\/a><br>\n<\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>    Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function.\n<\/code><\/pre>\n\n<\/div>\n\n\n\n<p>The problem is that i was using Hook inside of <code>Initialize<\/code> function of <code>useReducer Hook<\/code><\/p>\n\n<p>And it took me a while to find where I was getting this from.<\/p>\n\n<p>As a solution I tried to pass that hook value that Im trying to get inside of  <code>Initialize<\/code> function directly from the <code>functional component<\/code> where I use the <code>useReducer<\/code> hook but it turns out that <code>init<\/code> function only accepts only one argument so that was a bummer \ud83d\ude43 .<\/p>\n\n<p>My simple and time saving solution was just to get rid of the <code>init function<\/code> and set try to determine initial state directly in my <code>functional component<\/code> and that worked just fine<\/p>\n\n<p>Before<br>\n<\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight javascript\"><code>    <span class=\"k\">export<\/span> <span class=\"kd\">const<\/span> <span class=\"nx\">InitState<\/span> <span class=\"o\">=<\/span> <span class=\"p\">(<\/span><span class=\"nx\">initialState<\/span><span class=\"p\">)<\/span> <span class=\"o\">=&gt;<\/span> <span class=\"p\">{<\/span>\n      <span class=\"kd\">const<\/span> <span class=\"nx\">hookMeUp<\/span> <span class=\"o\">=<\/span> <span class=\"nx\">useMyHook<\/span><span class=\"p\">();<\/span> <span class=\"c1\">\/\/ &lt;- PROBLEM<\/span>\n\n      <span class=\"k\">return<\/span> <span class=\"p\">{<\/span>\n        <span class=\"p\">...<\/span><span class=\"nx\">initialState<\/span><span class=\"p\">,<\/span>\n      <span class=\"na\">yyy<\/span><span class=\"p\">:<\/span> <span class=\"nx\">hookMeUp<\/span><span class=\"p\">.<\/span><span class=\"nx\">yyy<\/span><span class=\"p\">,<\/span>\n      <span class=\"p\">};<\/span>\n    <span class=\"p\">};<\/span>\n\n    <span class=\"k\">export<\/span> <span class=\"kd\">const<\/span> <span class=\"nx\">FunComp<\/span> <span class=\"o\">=<\/span> <span class=\"p\">()<\/span><span class=\"o\">=&gt;<\/span><span class=\"p\">{<\/span>\n    <span class=\"kd\">const<\/span> <span class=\"nx\">initialState<\/span> <span class=\"o\">=<\/span> <span class=\"p\">{<\/span>\n        <span class=\"na\">xxx<\/span><span class=\"p\">:<\/span> <span class=\"mi\">1<\/span><span class=\"p\">,<\/span>\n            <span class=\"na\">yyy<\/span><span class=\"p\">:<\/span> <span class=\"mi\">2<\/span><span class=\"p\">,<\/span>\n      <span class=\"p\">};<\/span>\n\n    <span class=\"kd\">const<\/span> <span class=\"p\">[<\/span><span class=\"nx\">state<\/span><span class=\"p\">,<\/span> <span class=\"nx\">dispatch<\/span><span class=\"p\">]<\/span> <span class=\"o\">=<\/span> <span class=\"nx\">React<\/span><span class=\"p\">.<\/span><span class=\"nx\">useReducer<\/span><span class=\"p\">(<\/span><span class=\"nx\">MyReducerFun<\/span><span class=\"p\">,<\/span> <span class=\"nx\">initialState<\/span><span class=\"p\">,<\/span> <span class=\"nx\">InitState<\/span><span class=\"p\">);<\/span>\n\n    <span class=\"p\">...<\/span><span class=\"nx\">aaand<\/span> <span class=\"nx\">so<\/span> <span class=\"nx\">onnn<\/span><span class=\"p\">...<\/span>\n    <span class=\"p\">}<\/span>\n<\/code><\/pre>\n\n<\/div>\n\n\n\n<p>After<br>\n<\/p>\n\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight javascript\"><code>    <span class=\"k\">export<\/span> <span class=\"kd\">const<\/span> <span class=\"nx\">FunComp<\/span> <span class=\"o\">=<\/span> <span class=\"p\">()<\/span><span class=\"o\">=&gt;<\/span><span class=\"p\">{<\/span>\n\n    <span class=\"kd\">const<\/span> <span class=\"nx\">hookMeUp<\/span> <span class=\"o\">=<\/span> <span class=\"nx\">useMyHook<\/span><span class=\"p\">();<\/span>\n    <span class=\"o\">****<\/span>\n    <span class=\"kd\">const<\/span> <span class=\"nx\">xxx<\/span> <span class=\"o\">=<\/span>  <span class=\"nx\">hookMeUp<\/span><span class=\"p\">.<\/span><span class=\"nx\">xxx<\/span><span class=\"p\">;<\/span>\n    <span class=\"kd\">const<\/span> <span class=\"nx\">yyy<\/span> <span class=\"o\">=<\/span>  <span class=\"nx\">hookMeUp<\/span><span class=\"p\">.<\/span><span class=\"nx\">yyy<\/span><span class=\"p\">;<\/span>\n\n\n    <span class=\"kd\">const<\/span> <span class=\"na\">initialState<\/span><span class=\"p\">:<\/span> <span class=\"nx\">MyStateType<\/span> <span class=\"o\">=<\/span> <span class=\"p\">{<\/span>\n    <span class=\"nx\">xxx<\/span><span class=\"p\">,<\/span>\n    <span class=\"nx\">yyy<\/span>\n      <span class=\"p\">};<\/span>\n\n      <span class=\"nx\">React<\/span><span class=\"p\">.<\/span><span class=\"nx\">useEffect<\/span><span class=\"p\">(()<\/span> <span class=\"o\">=&gt;<\/span> <span class=\"p\">{<\/span>\n        <span class=\"kd\">const<\/span> <span class=\"nx\">onResizeCallBack<\/span> <span class=\"o\">=<\/span> <span class=\"p\">()<\/span> <span class=\"o\">=&gt;<\/span> <span class=\"nx\">dispatch<\/span><span class=\"p\">({<\/span> <span class=\"na\">type<\/span><span class=\"p\">:<\/span> <span class=\"dl\">\"<\/span><span class=\"s2\">onResize<\/span><span class=\"dl\">\"<\/span> <span class=\"p\">});<\/span>\n        <span class=\"nb\">window<\/span><span class=\"p\">.<\/span><span class=\"nx\">addEventListener<\/span><span class=\"p\">(<\/span><span class=\"dl\">\"<\/span><span class=\"s2\">resize<\/span><span class=\"dl\">\"<\/span><span class=\"p\">,<\/span> <span class=\"nx\">onResizeCallBack<\/span><span class=\"p\">);<\/span>\n        <span class=\"k\">return<\/span> <span class=\"p\">()<\/span> <span class=\"o\">=&gt;<\/span> <span class=\"nb\">window<\/span><span class=\"p\">.<\/span><span class=\"nx\">removeEventListener<\/span><span class=\"p\">(<\/span><span class=\"dl\">\"<\/span><span class=\"s2\">resize<\/span><span class=\"dl\">\"<\/span><span class=\"p\">,<\/span> <span class=\"nx\">onResizeCallBack<\/span><span class=\"p\">);<\/span>\n      <span class=\"p\">});<\/span>\n\n      <span class=\"kd\">const<\/span> <span class=\"p\">[<\/span><span class=\"nx\">state<\/span><span class=\"p\">,<\/span> <span class=\"nx\">dispatch<\/span><span class=\"p\">]<\/span> <span class=\"o\">=<\/span> <span class=\"nx\">React<\/span><span class=\"p\">.<\/span><span class=\"nx\">useReducer<\/span><span class=\"p\">(<\/span><span class=\"nx\">MyReducerFun<\/span><span class=\"p\">,<\/span> <span class=\"nx\">initialState<\/span><span class=\"p\">);<\/span>\n\n    <span class=\"p\">...<\/span><span class=\"nx\">aaand<\/span> <span class=\"nx\">so<\/span> <span class=\"nx\">onnn<\/span><span class=\"p\">...<\/span>\n    <span class=\"p\">}<\/span>\n<\/code><\/pre>\n\n<\/div>\n\n\n\n<p>links:<\/p>\n\n<ul>\n<li><a href=\"https:\/\/reactjs.org\/docs\/hooks-reference.html\">https:\/\/reactjs.org\/docs\/hooks-reference.html<\/a><\/li>\n<\/ul>\n\n","category":["react","javascript","reacthooks"]}]}}