<?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>DEV Community: Bony Roopchandani</title>
    <description>The latest articles on DEV Community by Bony Roopchandani (@bony2023).</description>
    <link>https://dev.to/bony2023</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%2F68765%2Fa1a4a925-3863-48c7-b2b9-152c00906dc9.jpg</url>
      <title>DEV Community: Bony Roopchandani</title>
      <link>https://dev.to/bony2023</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bony2023"/>
    <language>en</language>
    <item>
      <title>Why did I add a Terminal on my website (and how you can do it too)?</title>
      <dc:creator>Bony Roopchandani</dc:creator>
      <pubDate>Sat, 11 Jan 2020 07:56:20 +0000</pubDate>
      <link>https://dev.to/bony2023/why-i-added-a-terminal-on-my-website-and-how-you-can-do-it-too-nd5</link>
      <guid>https://dev.to/bony2023/why-i-added-a-terminal-on-my-website-and-how-you-can-do-it-too-nd5</guid>
      <description>&lt;p&gt;Being a Software Engineer, I always had this idea to have some kind of element on my &lt;a href="https://bonyroopchandani.com/"&gt;personal website&lt;/a&gt; which not only showcases my skills but also gives it a bit of "&lt;em&gt;nerd&lt;/em&gt;" touch. So, I went ahead and built a static Terminal having custom commands.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vhHy7Djo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/pn1qm4il0mwpabt06gf2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vhHy7Djo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/pn1qm4il0mwpabt06gf2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This React component is also published as an NPM &lt;a href="https://www.npmjs.com/package/react-terminal"&gt;package&lt;/a&gt; for anyone who wants to add it to their app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Show me the details
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installing
&lt;/h3&gt;

&lt;p&gt;Install it using NPM &lt;code&gt;npm install react-terminal&lt;/code&gt; or YARN &lt;code&gt;yarn add react-terminal&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;p&gt;Just declare the &lt;code&gt;commands&lt;/code&gt; object (key-value pair where value can be either a string or callback) and pass it as props to the component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { ReactTerminal } from "react-terminal";

function MyComponent(props) {
  // Define commands here
  const commands = {
    whoami: "jackharper",
    cd: (directory) =&amp;gt; `changed path to ${directory}`
  };

  return (
    &amp;lt;ReactTerminal
      commands={commands}
    /&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Also, make sure to wrap the application mount point around &lt;code&gt;TerminalContextProvider&lt;/code&gt;. This retains the state even when the component is unmounted and then mounted back:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { TerminalContextProvider } from "react-terminal";

ReactDOM.render(
  &amp;lt;TerminalContextProvider&amp;gt;
    &amp;lt;App/&amp;gt;
  &amp;lt;/TerminalContextProvider&amp;gt;,
  rootElement
);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;For a full list of props, please check the &lt;a href="https://github.com/bony2023/react-terminal#readme"&gt;readme&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://l9fvi.csb.app/"&gt;Link to Demo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://codesandbox.io/s/react-terminal-example-l9fvi?fontsize=14&amp;amp;hidenavigation=1&amp;amp;theme=dark"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pzpI10jk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codesandbox.io/static/img/play-codesandbox.svg" alt="Edit in CodeSandbox"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you found a bug in this library, please file a GitHub issue &lt;a href="https://github.com/bony2023/react-terminal/issues"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>terminal</category>
      <category>frontend</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
