<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Arbaaz</title>
    <description>The latest articles on Forem by Arbaaz (@arbaaz).</description>
    <link>https://forem.com/arbaaz</link>
    <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%2F27640%2Fc6d969c8-f193-4666-9284-f0846cb4db8e.png</url>
      <title>Forem: Arbaaz</title>
      <link>https://forem.com/arbaaz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/arbaaz"/>
    <language>en</language>
    <item>
      <title>Why I failed to launch on Appsumo</title>
      <dc:creator>Arbaaz</dc:creator>
      <pubDate>Fri, 04 Aug 2023 12:41:19 +0000</pubDate>
      <link>https://forem.com/arbaaz/why-i-failed-to-launch-on-appsumo-56a3</link>
      <guid>https://forem.com/arbaaz/why-i-failed-to-launch-on-appsumo-56a3</guid>
      <description>&lt;p&gt;From my experience, Appsumo is a good platform for driving traffic.&lt;/p&gt;

&lt;p&gt;I attempted to submit &lt;a href="https://neeto.com/neetocal"&gt;neetoCal&lt;/a&gt;, to Appsumo. &lt;/p&gt;

&lt;p&gt;Unfortunately, after waiting for several weeks, my submission was not approved. When we inquired with the Business Development Team, they explained that since 95% of the features of neetoCal are in the free plan, it did not meet the requirements for a deal on Appsumo. They suggested pricing it at $29, similar to Tidycal (by Appsumo), and launching it on the platform. &lt;/p&gt;

&lt;p&gt;I understand where Appsumo is coming from. However, neetoCal’s pricing reflects our belief that scheduling software is a commodity and thus should be &lt;a href="https://blog.neeto.com/p/neetocal-a-calendly-alternative-is"&gt;priced as a commodity&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you're interested, here's the deal that you missed &lt;a href="https://www.neeto.com/neetocal"&gt;https://www.neeto.com/neetocal&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Smile that Conquers Failure</title>
      <dc:creator>Arbaaz</dc:creator>
      <pubDate>Thu, 19 Jan 2023 00:00:00 +0000</pubDate>
      <link>https://forem.com/arbaaz/the-smile-that-conquers-failure-43no</link>
      <guid>https://forem.com/arbaaz/the-smile-that-conquers-failure-43no</guid>
      <description>&lt;p&gt;As a new father, I have been blessed with the opportunity to watch my daughter take her first baby steps. It has been an incredible experience to see her learn and grow, and I have been eager to be a part of it every step of the way.&lt;/p&gt;

&lt;p&gt;One evening, as we were out for our usual walk, my daughter began falling more often than usual. As a concerned father, I worried that she might start crying and that I would have to carry her back home. However, to my surprise, she didn't cry. Instead, she kept trying to stand up with a smile on her face.&lt;/p&gt;

&lt;p&gt;This moment was a powerful reminder to me of the importance of perseverance and determination. As adults, we often give up too quickly when faced with challenges or obstacles. We let setbacks discourage us and make us lose sight of our goals. But my daughter's example showed me that if we keep trying to stand up with a smile on our faces, even when we fall, we can achieve so much more.&lt;/p&gt;

&lt;p&gt;It's easy to get discouraged in life, but it's important to remember that every step, every fall, and every stumble is a step towards progress. And like my daughter, we can choose to embrace those moments with a smile and learn from them.&lt;/p&gt;

&lt;p&gt;So, let's take inspiration from our little ones and keep trying to stand up with a smile, no matter how many times we fall. Because as long as we keep moving forward, we will reach our goals and learn to walk.&lt;/p&gt;

</description>
      <category>parenting</category>
      <category>motivation</category>
      <category>failure</category>
      <category>success</category>
    </item>
    <item>
      <title>How to write rescript bindings for a react library</title>
      <dc:creator>Arbaaz</dc:creator>
      <pubDate>Mon, 23 Aug 2021 01:28:36 +0000</pubDate>
      <link>https://forem.com/arbaaz/how-to-write-rescript-bindings-for-a-react-library-31b5</link>
      <guid>https://forem.com/arbaaz/how-to-write-rescript-bindings-for-a-react-library-31b5</guid>
      <description>&lt;p&gt;Bindings are nothing but  &lt;a href="https://en.wikipedia.org/wiki/Foreign_function_interface"&gt;FFI&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;According to wiki:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written in another.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ReScript bindings are just an unsafe direct-access mechanism to the JS world. Just some external declarations and some type definitions.&lt;/p&gt;

&lt;p&gt;In this post, we are going to write few bindings for the antd library.&lt;/p&gt;

&lt;p&gt;Let's get started with a very simple component that doesn't accept any props or children.&lt;/p&gt;

&lt;h3&gt;
  
  
  Named Import
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Component
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// closeCircleOutlined.jsx
import { CloseOutlined } from '@ant-design/icons'
/* npm install --save @ant-design/icons */

ReactDOM.render(
 &amp;lt;CloseOutlined /&amp;gt;,
 mountNode,
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Binding:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res
module CloseCircleOutlined = {
 @module("@ant-design/icons") @react.component
 external make: React.element = "CloseCircleOutlined"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Default Import
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res

// import CloseOutlined from '@ant-design/icons'
module CloseOutlined = {
 @module("@ant-design/icons") @react.component
 external make: React.element = "default"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm assuming you know what decorators are. If you haven't read about them before then you can read &lt;a href="https://rescript-lang.org/docs/manual/latest/attribute"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ** basic structure ** is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module ComponentName = {
 @module("&amp;lt;node_module_name&amp;gt;") @react.component
 external make: React.element = "&amp;lt;NamedImport&amp;gt; or &amp;lt;default&amp;gt;"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This component doesn't accept any props yet.  &lt;/p&gt;

&lt;p&gt;Let's write another binding for a &lt;a href="https://ant.design/components/button/"&gt;button&lt;/a&gt;. &lt;/p&gt;

&lt;h4&gt;
  
  
  Component:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Button } from 'antd';

ReactDOM.render(
  &amp;lt;&amp;gt;
    &amp;lt;Button shape="circle"&amp;gt;Circle Button&amp;lt;/Button&amp;gt;
    &amp;lt;Button shape="round"&amp;gt;Round Button&amp;lt;/Button&amp;gt;
  &amp;lt;/&amp;gt;,
  mountNode,
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Binding:
&lt;/h4&gt;

&lt;p&gt;Copy the structure and fill in the names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res
module Button = {
 @module("antd") @react.component
 external make: React.element = "Button"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, you can only use the button as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Button/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;not as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Button shape="circle"&amp;gt;Text&amp;lt;/Button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Props
&lt;/h3&gt;

&lt;p&gt;Let's add a &lt;code&gt;shape&lt;/code&gt; prop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res
module Button = {
 @module("antd") @react.component
 external make: (~shape:string) =&amp;gt; React.element = "Button"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember, we have to declare each &lt;strong&gt;prop&lt;/strong&gt; as a  &lt;strong&gt;Named argument.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Keyword prop
&lt;/h3&gt;

&lt;p&gt;Now, here is a little tricky one. Let's add a &lt;code&gt;type&lt;/code&gt; prop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res
module Button = {
 @module("antd") @react.component
 external make: (~\"type": string, ~shape:string) =&amp;gt; React.element = "Button"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;type&lt;/code&gt; is a keyword in a rescript so whenever we use a  &lt;strong&gt;keyword&lt;/strong&gt; we have to escape it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Children
&lt;/h3&gt;

&lt;p&gt;To accept the &lt;strong&gt;child component&lt;/strong&gt;, we will use &lt;code&gt;children&lt;/code&gt; named argument&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res
module Button = {
 @module("antd") @react.component
 external make: (~children:React.element, ~shape:string, ~\"type": string) =&amp;gt; React.element = "Button"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// App.res
ReactDOM.render(
 &amp;lt;Button \"type"="primary" shape="circle"&amp;gt;{React.string("Click me")}&amp;lt;/Button&amp;gt;, 
 mountNode
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  React prop
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bindings.res
module Button = {
 @module("antd") @react.component
 external make: (~icon: React.element, ~children:React.element, ~shape:string, ~\"type": string) =&amp;gt; React.element = "Button"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// App.res
ReactDOM.render(
 &amp;lt;Button icon={&amp;lt;DownloadOutlined /&amp;gt;} shape="circle" \"type"="primary"&amp;gt;{React.string("Click me")}&amp;lt;/Button&amp;gt;, 
 mountNode
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all folks!&lt;/p&gt;

</description>
      <category>rescript</category>
      <category>react</category>
      <category>functional</category>
    </item>
    <item>
      <title>A Developer's Guide to Productivity</title>
      <dc:creator>Arbaaz</dc:creator>
      <pubDate>Tue, 01 Jun 2021 03:26:42 +0000</pubDate>
      <link>https://forem.com/arbaaz/guide-to-productivity-1o3d</link>
      <guid>https://forem.com/arbaaz/guide-to-productivity-1o3d</guid>
      <description>&lt;p&gt;We all know how vital &lt;strong&gt;'Decision Making'&lt;/strong&gt; is for success, yet we make wrong decisions often. While it's easier to make the big decisions, it's harder to make the smaller ones. What we don't realize is the total of tiny choices that determine our success in life. &lt;/p&gt;

&lt;p&gt;We know how to think, plan, and execute big decisions like choosing a career path or marrying or living. We prepare, set aside time and space for it. &lt;/p&gt;

&lt;p&gt;But when it comes to the tiny ones, like when to sleep or that one glass of cold lemonade on a summer night, that might give you a sore throat. It's harder for you to plan like you would for the big ones. You do it and face the unintended consequences.&lt;/p&gt;

&lt;p&gt;Today, we have more 'choices' than we can count for any given thing. Psychologist Barry Schwartz says in  &lt;a href="https://www.ted.com/talks/barry_schwartz_the_paradox_of_choice?language=en#t-470586"&gt;"Paradox of Choice"&lt;/a&gt; that while more choices allow us to achieve better results, they also lead to greater anxiety, indecision, and dissatisfaction. &lt;/p&gt;

&lt;p&gt;With freedom of choice comes the responsibility to make the right ones.&lt;/p&gt;

&lt;p&gt;Failing to know these ** 'tiny' dos and don'ts** might affect our &lt;strong&gt;momentum&lt;/strong&gt; in essential tasks. &lt;/p&gt;

&lt;p&gt;Let's see how can we fix them&lt;/p&gt;

&lt;h2&gt;
  
  
  Make it Clear
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vgyV0ILP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252179605/DMtYL5Ftk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vgyV0ILP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252179605/DMtYL5Ftk.png" alt="" width="800" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://psychology.stackexchange.com/questions/17182/basis-for-we-make-35-000-decisions-a-day-statistic/17184#17184?newreg=6c5ad36acbcc463daefdc4d90304c492"&gt;some sources&lt;/a&gt;, we make thousands of decisions every day. &lt;/p&gt;

&lt;p&gt;We can't make decisions upon decisions without paying a biological cost. Decisions have an unseen biological cost that we can't see and neglect.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"There is nothing to writing. All you do is sit down at a typewriter and bleed." ― Ernest Hemingway.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just knowing 'clearly' what you need to do or not is half the battle won. Write down activities that you need to do, as well as avoid them to be more productive. Things like - what to eat, what to wear, when to shop, how to use your apps, morning routines, sleep routines, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cut it Out
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jtoGm-8L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252203188/yyQzXGDZZ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jtoGm-8L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252203188/yyQzXGDZZ.jpeg" alt="Productivity  5.jpg" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we make too many decisions, we suffer from &lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/Decision_fatigue"&gt;Decision Fatigue&lt;/a&gt;&lt;/strong&gt;. It leaves us with less energy for mentally demanding tasks, &lt;a href="https://www.scientificamerican.com/article/don-t-overthink-it-less-is-more-when-it-comes-to-creativity/"&gt;killing creativity&lt;/a&gt;, drive and, in turn, affects happiness.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The essence of strategy is choosing what not to do ― Michael Porter&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Cutting out every unnecessary or unmade decision makes room and energy for productive ones. According to a &lt;a href="https://www.ics.uci.edu/~gmark/chi08-mark.pdf"&gt;University of California Irvine study&lt;/a&gt;, it takes an average of 23 minutes to get back to a task after an interruption.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try to estimate your focused time in a day as well as the cost of time breaks or energy leaks.&lt;/strong&gt; &lt;br&gt;
To build momentum and maintain it. Simplify your day and daily routine with habits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time It, Space It
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iuedOPNp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252217370/GIEHQNCPA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iuedOPNp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252217370/GIEHQNCPA.jpeg" alt="Productivity3.jpg" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
Mornings are the natural way to start life. It's no wonder &lt;a href="https://youtu.be/qszsMyrChnE"&gt;most successful people start super early&lt;/a&gt;. After a good night's sleep, our body and brain are charged up for best performance. &lt;/p&gt;

&lt;p&gt;Make a list of priorities - starting with the most challenging task because your brain is fresh and ready to handle it earlier in the day. &lt;a href="https://www.pnas.org/content/pnas/108/17/6889.full.pdf"&gt;Studies&lt;/a&gt; have shown how the time of day affects good decision making and productivity.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"In preparing for battle, I have always found that plans are useless, but planning is indispensable." ― Dwight D. Eisenhower&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As there's no such thing as 'stability' in life, make mental and practical space to account for new or unexpected situations. Take breaks or a quick nap to recharge during the day. Intentionally STOP making decisions. &lt;br&gt;
Leave room for new beginnings which usually take time and space, and let your brain sort things at its own pace.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make it Right
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PFcDabj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252229991/2iPsZHHA_.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PFcDabj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252229991/2iPsZHHA_.jpeg" alt="Productivity 4.jpg" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
Identify your purpose – and make sure it's right. Please write down your goals and objectives to achieve them, and review them. Everything you do during the day, week, and year must align with this purpose, getting more efficient with time. Build habits around your goals.&lt;/p&gt;

&lt;p&gt;Get a second opinion or some sound advice on your ideas to avoid your own cognitive biases. And be ready to iterate on your decisions based on outcomes. Iterative decision-making is faster, efficient, and leads to better results.&lt;/p&gt;

&lt;p&gt;It doesn't matter how 'right' our choice is, but how motivated and committed we are to make it right. Having an actionable plan with the best decision is what leads to a success story.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do It
&lt;/h2&gt;

&lt;p&gt;No amount of thinking or planning can take you closer to your goals. You have to give it a try and get started. Take action and be ready to fail. But pick yourself up and try again. Or change the course.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5SVe0hrz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252267328/2XOHfUquJ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5SVe0hrz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1622252267328/2XOHfUquJ.jpeg" alt="Productivity 6.jpg" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Unless commitment is made, there are only promises and hopes; but no plans." ― Peter F. Drucker&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In summary, decision-making is more exhausting than any other mental activity.It's a lot of tiny things that make you or break you. So be mindful of how you regard them. Understand the proven and sustainable methods that seem dull or straightforward, but work. &lt;br&gt;
Tweak them to suit your purpose. Avoid all sorts of distractions as much as possible. Respect your mind and body. &lt;/p&gt;

&lt;p&gt;Believe in yourself, work hard and stay healthy!&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>planning</category>
      <category>selfdevelopment</category>
      <category>decisionmaking</category>
    </item>
    <item>
      <title>How to append child to body with rescript</title>
      <dc:creator>Arbaaz</dc:creator>
      <pubDate>Tue, 25 May 2021 05:06:14 +0000</pubDate>
      <link>https://forem.com/arbaaz/how-to-append-child-to-body-in-rescript-3gnc</link>
      <guid>https://forem.com/arbaaz/how-to-append-child-to-body-in-rescript-3gnc</guid>
      <description>&lt;p&gt;Install bs-webapi&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save&lt;/span&gt; bs-webapi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the entry to bsconfig.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"bs-dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"bs-webapi"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;use the following snippet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rescript"&gt;&lt;code&gt;&lt;span class="k"&gt;open&lt;/span&gt; &lt;span class="nn"&gt;Webapi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Dom&lt;/span&gt;
&lt;span class="k"&gt;open&lt;/span&gt; &lt;span class="nc"&gt;Belt&lt;/span&gt;

&lt;span class="n"&gt;document&lt;/span&gt;
&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;asHtmlDocument&lt;/span&gt;
&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;Option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;flatMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;HtmlDocument&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;Option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"div"&lt;/span&gt;, &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;Element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"app"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;// ReactDOM.render(&amp;lt;App /&amp;gt;, root) // if you are using react&lt;/span&gt;
  &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nn"&gt;Element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ignore&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>rescript</category>
      <category>dom</category>
      <category>createelement</category>
      <category>appendchild</category>
    </item>
  </channel>
</rss>
