Skip to content

Instantly share code, notes, and snippets.

View simbathesailor's full-sized avatar
🎯
Focusing

Anil Kumar Chaudhary simbathesailor

🎯
Focusing
View GitHub Profile
@simbathesailor
simbathesailor / react-image-zoom-hook.ts
Created October 2, 2019 08:03
React image zoom hook result types
interface Result {
moveLens: (event: React.MouseEvent<any, MouseEvent>) => void;
imgContainerDimesions: {
height: string,
width: string,
position: 'relative'
};
@simbathesailor
simbathesailor / index.jsx
Created October 5, 2019 16:02
Rendering linst of elements
const jobsTitleList = [
"Product Manager",
"React Engineer",
"NodeJS Engineer",
"Python Engineer"
];
function App() {
return (
<div className="App">
@simbathesailor
simbathesailor / jobwithdescription.jsx
Created October 6, 2019 03:26
Props and State(jobs with description array)
const jobs = [
{
title: "Product Manager",
description:
"Suspendisse volutpat in quam cras vestibulum eleifend condimentum."
},
{
title: "React Engineer",
description:
"Suspendisse volutpat in quam cras vestibulum eleifend condimentum."
@simbathesailor
simbathesailor / returnedMutipleElements.jsx
Created October 6, 2019 04:27
Props and State(returnedMutipleElements)
/**JSX need to be wrapped inside some containing element
in Reactjs **/
jobs.map(() => {
return (
<div>
<h3>{title}</h3>
<p>{description}</p>
</div>
)
})
@simbathesailor
simbathesailor / JobComponentWIthouthandler.jsx
Created October 6, 2019 04:59
Props and state(JobComponentWIthouthandler)
function Job({ job }) {
const { title, description } = job
return (
<>
<h3>{title}</h3>
<p>{description}</p>
</>
)
}
@simbathesailor
simbathesailor / ReturnJObComponent.jsx
Created October 6, 2019 05:04
Props and state(ReturnJObComponent)
{
jobs.map((job, index) => {
return <Job key={index} job={job} />
})
}
@simbathesailor
simbathesailor / LocalvalueComponent.jsx
Created October 6, 2019 05:33
Props and State (LocalvalueComponent)
function Job({ job }) {
const { title, description } = job;
const valueLocalToThisComponent = 1
return (
<>
<h3>{title}</h3>
<p>{description}</p>
<p>{valueLocalToThisComponent}</p>
</>
);
@simbathesailor
simbathesailor / useStateExample.jsx
Created October 6, 2019 07:13
Prop and State (useState example)
function Job({ job }) {
const { title, description } = job;
const [shouldShowDescription, setShouldShowDescription] = useState(false);
function handleClick(e) {
setShouldShowDescription(shouldShowDescription ? false : true);
}
return (
<>
@simbathesailor
simbathesailor / FIlterjobwithoutonchange.jsx
Created October 9, 2019 16:00
FIlterjobwithoutonchange.jsx
function FilterJobs({ value }) {
return (
<input
value={value}
/>
);
}
@simbathesailor
simbathesailor / JobListAndApp.jsx
Created October 9, 2019 16:34
JobListAndApp.jsx
function JobsList() {
return jobs.map((job, index) => {
return <Job key={index} job={job} />
})
}
function App() {
return (
<div className="App">
<JobsList value={value} />
</div>