Went for my first hackathon!! :D
leanminmachine

leanminmachine @leanminmachine

About: Today I Learned...

Location:
NYC, NY
Joined:
Jul 14, 2018

Went for my first hackathon!! :D

Publish Date: Jul 29 '18
11 3

GUYS!! I'm feeling so happy right now, I just spent 1.5 days putting something together. It's nothing too impressive (basically just a react-native application where user fills in some information, then the information is compared to other users' informations, and returns appropriate matches based on a scoring formula). I'm kinda rusty on React atm when the last time I've touched it was 1 year ago and tons of things have changed since then!

STILL. I'm really so happy because I haven't been coding a lot (have been busy with user interviews!). This was one of the few days that I really could spend 12h a day coding (miss those days man), and made me realise that wholeheartedly investing my time on a side project can allow me to learn so much in a short span of time. Although without a hackathon i feel less motivated to do so :(

Anyway, here's the basic stuff I've learnt/refreshed from my memory, from building my tiny little application.

    handleSubmit = () => {
        const value = this._form.getValue(); // use that ref to get the form value

        this.setState((prevState) => {
            return {mentor: value}
        });

        console.log('state', this.state);

      }

From previous screen:

this.props.navigation.navigate('Results', {mentor: this.state.mentor});

Store the object within local state of the screen first.

From next screen:
In render method:
this.props.navigation.state.params

  • Import JSON from a local file

import menteesData from '../data/mentee_data.json';

I didn't know it was that easy lol.

    filterByTiming = (mentor, mentees) => {
        let matches = mentees.filter(mentee => {
            console.log('*** mapped mentor ***', mentor);
            console.log('*** mapped mentee timing ***', mentee.timing);

            if (mentor.timing == mentee.timing) {
                console.log('matches currently: ', matches);
                return mentee;
            } else {
                return false; //skip
            }

        }).map(mentee => {return mentee; });

        console.log('matches : ', matches);
        return matches;
    }

You should instead use the in operator:

"key" in obj // true, regardless of the actual value

Sort comparator function!

    // returns a sorted list, from highest score to lowest score
    sortByScore = (arr) => {
    arr.sort(function(obj1, obj2) {
        return obj2.score - obj1.score;
    });
    return arr;
    }

Comments 3 total

  • Ben Halpern
    Ben HalpernJul 30, 2018

    Woohoo!

  • khairil azizee
    khairil azizeeJul 30, 2018

    nice!

  • Juan F Gonzalez
    Juan F Gonzalez Aug 2, 2018

    Congrats on the hackathon and thanks for sharing! I'm also getting the hang of React again with all the things that have changed (and be prepared for all the other things that Are going to change :p)

Add comment