import { createContext } from 'react';
const NameContext = createContext('');
function App() {
return (
<NameContext.Provider value="John Doe">
<Body />
<NameContext.Provider>
);
}
function Body() {
return <Greeting />;
}
function Greeting() {
return (
<NameContext.Consumer>
{name => <h1>Welcome, {name}</h1>}
</NameContext.Consumer>
);
}
const MyContext = React.createContext(defaultValue);
Code Example |
---|
Html :: how to put the heading in th ecenter of th html page |
Html :: how to run html file in xampp server |
Html :: mailchimp form action |
Html :: button |
Html :: height 100% tailwind |
Html :: html extarea line break |
Html :: font html |
Html :: aria list |
Html :: horizontal line in table |
Html :: Superscript the word using html |
Html :: html gallery |
Html :: Tagging with multi-value select boxes |
Html :: meta tag white theme |
Html :: html make card |
Html :: emmet edit true or false sublime text |
Html :: bootstrap dropdown |
Html :: html go to specific part of page |
Html :: display element with ng-template |
Html :: react uncontrolled input initial value |
Html :: html card |
Html :: how to work on portfolio in html and css |
Html :: twig batch |
Html :: metabase |
Html :: jspdf html to pdf angular 8 |
Html :: typo3 link |
Html :: input group |
Html :: making spinner in css |
Html :: solidity syntax return |
Html :: html cheetsheet.com |
Html :: html colors |