Coder Social home page Coder Social logo

dad-jokes's Introduction

Project Overview

Project Description

Dad Jokes an app built for a laugh using React and an API

Wireframes

Upload images of wireframe to cloudinary and add the link here with a description of the specific wireframe.

MVP EXAMPLE

  • Find and use external api
  • Render data on page
  • Navigation to routes
  • Random joke
  • Search for joke

PostMVP EXAMPLE

  • Allow user to choose favorites
  • Save their choices in firebase
  • Add user auth

React Component Hierarchy

App > Header > Nav

App > Search > JokesList > JokeItem

App > RandomJoke

App > Footer

State Components

App

Functional Components

Search, JokesList, JokeItem, RandomJoke, Header, Nav, Footer

Component Description
Header This will render the header include the nav
Nav This will render the nav
Search This will render the search input text and button
JokesList This will render the list of jokes returned from search
JokeItem This will render the joke item in the list
RandomJoke This will render the random joke with button to randomize joke
Footer This will render the footer include the link to github and api
Component Priority Estimated Time Time Invetsted Actual Time
Set up app H .5hrs .5hrs .5hrs
Random H 2hrs 2.5hrs 2.5hrs
Search Form H 3hrs 3.5hrs 2.5hrs
Footer and Header H 3hrs 3.5hrs 1.5hrs
React Router H 2hrs 1.5hrs 1.5hrs
Style H 2hrs 2.5hrs 2.5hrs
Total H 12.5hrs 14hrs 11hrs

Helper Functions

Function Description
Footer This component could be use in playground projects

Additional Libraries

icanhazdadjoke API

Code Snippet

All state for app is contained in App.js

this.state = {
	randomJoke: '',
	jokes: [],
	term: ''
}

Issues and Resolutions

Use this section to list of all major issues encountered and their resolution.

ERROR: Unexpected token < in JSON at position 0
RESOLUTION: https://daveceddia.com/unexpected-token-in-json-at-position-0/

Sent request with header to accept json data

randomAPI() {
    let api = 'https://icanhazdadjoke.com/'
    fetch(api,
      {
        headers: {
          'Accept': 'application/json',
          'User-Agent': ' My Library (https://github.com/tara-fenton/dad-jokes)'
        }
      }
    ).then(response => response.json())
      .then(json => {
        this.setState({ randomJoke: json.joke })
      }).catch(e => console.log(e))
  }

logic setting up button events testing events

logic setting up search events testing search events

dad-jokes's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.