This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Authorize] | |
| [ApiController] | |
| [Route("[controller]")] | |
| public class WeatherForecastController : ControllerBase | |
| { | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddControllers(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
| { | |
| ... | |
| app.UseEndpoints(endpoints => | |
| { | |
| endpoints.MapControllers(); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <List | |
| data={["Fred", "Bob", "Jane"]} | |
| renderHeader={() => <h3>Names</h3>} | |
| renderItem={item => ( | |
| <div> | |
| <span style={{ marginRight: "10px" }}>{item}</span> | |
| <button>Click me</button> | |
| </div> | |
| )} | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Props { | |
| data: string[]; | |
| renderItem?: (item: string) => JSX.Element; | |
| renderHeader?: () => JSX.Element; | |
| } | |
| export const List: FC<Props> = ({ data, renderItem, renderHeader }) => ( | |
| <div className="list"> | |
| <div className="list-header">{renderHeader && renderHeader()}</div> | |
| <ul> | |
| {data.map(item => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Card renderHeader={() => <h3>A custom header</h3>}> | |
| <p>Some interesting text</p> | |
| <button>Click me</button> | |
| </Card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Props { | |
| title?: string; | |
| renderHeader?: () => JSX.Element; | |
| } | |
| export const Card: FC<Props> = ({ children, title, renderHeader }) => ( | |
| <div className="card"> | |
| <div className="card-header"> | |
| {renderHeader ? renderHeader() : title !== undefined ? title : null} | |
| </div> | |
| <div className="card-content">{children}</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Card> | |
| <p>Some interesting text</p> | |
| <button>Click me</button> | |
| </Card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const Card: FC = ({ children }) => ( | |
| <div className="card"> | |
| {children} | |
| </div> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Props { | |
| ... | |
| renderItem?: (item: string) => JSX.Element; | |
| renderHeader?: () => JSX.Element; | |
| } |