Code Monkey home page Code Monkey logo

hackernews-remix-react's Issues

Setup command typo

Hi,
Wanted to point out that the folder and project name both have a typo in the setup command.
react and remix should be reversed.

Here is the diff (don't get access right to make a PR) :
-git clone https://github.com/clintonwoo/hackernews-react-remix.git && cd hackernews-react-remix && npm install && npm run dev

+git clone https://github.com/clintonwoo/hackernews-remix-react.git && cd hackernews-remix-react && npm install && npm run dev

Cheers.

Use `<Link/>` to take advantage of Remix navigation

Looks like all your links (see item-title.tsx) are using the standard <a/> tag, instead of <Link/>. This is causing the browser to reload the entire page on every navigation. By using the <Link/> component, Remix will issue a client-side fetch, then render the item page.

Deleting Cookies

Description

I am trying to rebuild the Hacker news web app, without using a database, and store user information (username) in cookies. Using a model similar to yours, I am currently able to add the username to the cookie header, but I am unable to delete. Here is the code for the login page, specifically the action that adds the cookie:

export async function action({ request }) {
  const session = await getSession(request.headers.get("Cookie"));
  const form = await request.formData();
  const username = form.get("name");
  const Password = form.get("password");

  // Login succeeded, send them to the home page.
  return redirect("http://localhost:3000/", {
    headers: {
      "Set-Cookie": username,
    },
  });
}

And here is the logout page:

import { ActionFunction, redirect } from "@remix-run/node";
import { getSession, destroySession } from "~/sessions";

export const loader: ActionFunction = async ({ request }) => {
  const session = await getSession(request.headers.get("Cookie"));
  //await destroySession(session);
  return redirect("/login", {
    headers: { "Set-Cookie": await destroySession(session) },
  });
};

Is there anything that I might be missing?

Set title on discussions

Clicking a comments link on the front page leads to a page with a title of 'Item | Hacker News Clone'.

On the real thing, the title is set to the same as the storylink text.

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.