Sunday, April 15, 2018

Net Ninja's React JS tutorial in c9.io - skipping webpack by using create-react-app

OK, many are the quirks in c9.io and many many are the quirks in configuring webpacket.

At this point I just want to improve how react itself works and not get bogged down in figgerin out webpacket (I will do that later, however).

So what I did was go through the first page or two of this tutorial: http://www.react.express/environment and am just figuring out how to do the Net Ninja tutorial on top of the template you get when you use create-react-app

The flavors of react are a little different bu I believe that will save me a lot of time.

First I got the create-react-app up and running just fine in the browser.

So going forward I am just tacking the Net Ninja components onto the existing app.

So for example the react app gives you

    import React from 'react';
    import ReactDOM from 'react-dom';
    import './index.css';
    import App from './App';
   import registerServiceWorker from './registerServiceWorker';

     ReactDOM.render(<App />, document.getElementById('root'));
     registerServiceWorker();

and 


    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './App.css';

    class App extends Component {
     render() {
         <header className="App-header">
              <img src={logo} className="App-logo" alt="logo" />
              <h1 className="App-title">Welcome to React</h1>
             </header>
            <p className="App-intro">
              To get started, KLJHKJLHKJ dit <code>src/App.js</code> and save to reload.
             </p>
        );
      }   
    }

    export default App;

So, for the very first component Net Ninja has us build, I just changed App to 

    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './App.css';

    class App extends Component {
     render() {
         return (
          <div className="App">
           <h1>hellooooooooo</h1>
          </div>
        );
      }   

    }

    export default App;


Now, if I wanted to in turn add a child component to App I can just do this:



    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './App.css';
    import Howdy from './Howdy';

    class App extends Component {
     render() {
         return (
          <div className="App">
           <h1>hellooooooooo</h1>
           <Howdy />
          </div>
        );
      }   

    }

    export default App;


and here is the 'Howdy' component:

    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './App.css';

    class Howdy extends Component {
     render() {
         return (
          <div className="App">
           <h1>howdy howdy howdy howdy howdy!</h1>
          </div>
        );
      }   
    }

    export default Howdy;

NOTICE THE FOLLOWING:

The App component can use the Howdy component because the App component contains

     import Howdy from './Howdy';

And the Index component can use the App component because the Index component contains

    import App from './App';

Monday, April 2, 2018

Learning to Code Over 40

I did not get super-serious about learning to code until I myself was in the 40+ set.

Allow me to share with you some hard-won wisdom:

1. DO NOT BE A HELP VAMPIRE

Don't know what a "help vampire" is? Google it. For at least the first year that you are learning this stuff, there are absolutely no questions or conundrums you will encounter that have not already been solved and documented in at least eight places. Unless you are trying to learn some brand spankin' new language or framework that just came out last year, the answers are already there somewhere for you to google. Do NOT add to the pile of stupid, poorly researched questions that have already been answered. You will only serve to discourage those who are willing to provide their time and talent to places like stackoverflow. Ultimately, you are shooting yourself in the foot. Train yourself to dig in and research the crap out of every corner of the internet when you encounter a sticky problem - apparently that is what real developers do. Welcome to the new normal.

2. DO NOT CODE ALONE

OK, obviously you are going to have to code all by yourself to get through the first few dozen tutorials in order to get a baseline understanding (unless you are starting down this road with a coding buddy, which I wish to heck I had!). What I mean, however, is that there is going to be a point where your mind has been expanded by this stuff, and you are champing at the bit to do more than just tutorials. It is a really, really bad idea to continue on all alone at this point. What you are going to end up doing is spend months reinventing the wheel to create nothing but irrelevant, low quality crap. If I sound bitter it is because I myself have wasted several months getting all wrapped up in projects I dreamed up and planned on my own, while all that time and energy could have gone to working with other people and learning the proper things like what good design actually is, what quality code actually is, and how things like Github work. Don't waste your time. Hook up with an opensource project when you are ready to actually start building new stuff.

3. IF IT DIDN'T HAPPEN ON GITHUB, IT DIDN'T HAPPEN

Most likely, the first five questions of any tech interview that you might go to sometime down the road are going to be questions about Github. Github is where your work will be expected to be stored. Github is how the quality of your code will be assessed. If you don't know Github, you don't know squat. If your code is not on Github, nobody is going to bother looking. Again, learn to code as part of a group of remote devs; this will force you to become very github-capable.