Skip to content

Instantly share code, notes, and snippets.

Trần Văn Luận luandevpro

  • Viet Nam
Block or report user

Report or block luandevpro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View getDatOfWeek.js
console.log(moment().isoWeekday(1).subtract(7, "days").format("DD/MM/YY"))
console.log(moment().isoWeekday(1).subtract(1, "days").format("DD/MM/YY"));
console.log(moment().isoWeekday(1).format("DD/MM/YY"))
console.log(moment().isoWeekday(7).format("DD/MM/YY"))
console.log(moment().subtract(1, 'months').daysInMonth())
View package.json
{
"name": "theme",
"version": "1.0.0",
"description": "Practicing making a Gatsby theme",
"main": "index.js",
"license": "MIT"
}
View Terminal
mkdir site
mkdir packages
cd packages
mkdir theme
cd theme
yarn init -y
touch index.js
cd ../../site/
yarn init -y
View package.json
{
"name": "gatsby-site",
"private": true,
"version": "1.0.0",
"workspaces": ["site", "packages/*"]
}
View Terminal
mkdir gatsby-themes
cd gatsby-themes
yarn init -y
View Toggle.js
import React from 'react';
import { Formik, Form, Field, FieldArray } from 'formik';
import styled from 'styled-components';
const languageState = [true];
export default () => {
const handleSubmit = values => {
console.log(values.languages);
};
View Radio.js
...
export default () => {
const handleSubmit = values => {
console.log(values.languages);
};
return (
<Formik
onSubmit={handleSubmit}
initialValues={{
languages: [],
View Radio.js
import React from 'react';
import { Formik, Form, Field, FieldArray } from 'formik';
import styled from 'styled-components';
const languageState = ['vi', 'en', 'jp'];
export default () => {
const handleSubmit = values => {
console.log(values.languages);
};
View CheckBox.js
const CheckBox = () => (
...
<input
id={`languages.${index}.language`}
type="checkbox"
name={`languages.${index}.language`}
value={language}
checked={arrayHelpers.form.values.languages.includes(
language
)}
View CheckBox.js
import React from 'react';
import { Formik, Form, Field, FieldArray } from 'formik';
import styled from 'styled-components';
const languageState = ['vi', 'en', 'jp'];
export default () => {
const handleSubmit = values => {
console.log(values.languages);
};
You can’t perform that action at this time.