Giter Site home page Giter Site logo

class_18-project's People

Contributors

zersolo avatar

Watchers

 avatar

class_18-project's Issues

Review

I've been asked to review your project.

It's great that you have a script to run both server and client.

  • I'd prefer to have only one package.json which made the thing easier
--src
--public
--server
--package.json //takes care all the dependencies for the server and client

Server

  • I don't know why you all have public folder with index.html and style.css inside server, you don't need it

validateHouse.js
typeof null returns "object" so i'd check if it's not null

index.js
While hosting the host will give you dynamic ports, you can't use 8000
so try
const PORT = process.env.PORT || 8000

api/index.js

  • I'd just stick with res.json instead of res.send for jsons
    -It would be better if you parse the int outside of the find loop

Client

App.js

  • Move the navBar to a diffrent component
  • 404
    isn't a valid componenet, render expecets a function
<Route render={() => <div> 404</div>} />

AddHouseFull.js
-Don't put more than one component in the same file, it will get messy later
-make sure invalidData is always an array or it will break the component

  • !! not necessary

AddHouseInputs.js

  • You are not passing the id to fetch, plus i'd wait for the response from the server then modify the local state
 const response = fetch('/api/houses/:id', {
            method: 'Delete',
        });
        const filteredItems = [...this.state.houses].filter(item => {
            return item.id !== id;
        });
        response.then(data => console.log(data));

        this.setState({
            houses: filteredItems,
        });
  • why do you do response.then() after filtering?
    you could directly do
fetch(`/api/houses/${id}`, {
            method: 'Delete',
        }).then(() => console.log("done"))

-Always handle the errors, make sure you have catch too for the fetch

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.