Navigates? | declarative? | Makes GET, triggers loader | Makes POST, triggers action | No requests |
---|---|---|---|---|
navigates | declarative | <Link to=""> <Form method="get"> |
<Form method="post"> |
<Link to="#..."> |
navigates | imperative | navigate() setSearchParams() |
submit() |
navigate("#") |
stays | declarative | <fetcher.Form method="get"> |
<fetcher.Form method="post"> |
(doesn't make sense) |
s |
An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.
The way we recommend handling redirects has changed in React Router v6. This document explains why.
In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect>
component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.
import { createHttpLink } from 'apollo-link-http' | |
import { ApolloLink, split, concat } from 'apollo-link' | |
import { ApolloClient } from 'apollo-client' | |
import { WebSocketLink } from 'apollo-link-ws' | |
import { getMainDefinition } from 'apollo-utilities' | |
import { InMemoryCache } from 'apollo-cache-inmemory' | |
import { onError } from 'apollo-link-error' | |
import { withClientState } from 'apollo-link-state' | |
import env from '../env.json' |
import React from 'react' | |
import { withRouter, Link } from 'react-router-dom' | |
import { graphql, compose } from 'react-apollo' | |
import { Formik } from 'formik' | |
import Yup from 'yup' | |
import FormWideError from '../elements/form/FormWideError' | |
import TextInput from '../elements/form/TextInput' | |
import Button from '../elements/form/Button' | |
import { H2 } from '../elements/text/Headings' |
I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.
It's currently synchronized with my .vimrc
config except for a block of neovim-specific terminal key mappings.
This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.
These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,
#!/usr/bin/env bash | |
sudo yum groups install -y Development\ tools | |
sudo yum install -y cmake | |
sudo yum install -y python34-{devel,pip} | |
sudo pip-3.4 install neovim --upgrade | |
( | |
cd "$(mktemp -d)" | |
git clone https://github.com/neovim/neovim.git | |
cd neovim | |
make CMAKE_BUILD_TYPE=Release |
function fetchJSON(url, options, callback) { | |
if (typeof options === 'function') { | |
callback = options | |
options = {} | |
} | |
options = options || {} | |
const headers = (options.headers || (options.headers = {})) | |
headers.Accept = 'application/json' |
var request = require('request'); | |
var sendMessage = function(device, message){ | |
var restKey = '****'; | |
var appID = '****'; | |
request( | |
{ | |
method:'POST', | |
uri:'https://onesignal.com/api/v1/notifications', | |
headers: { |