parsed-path tagged location to parse your pathname
This example creates two simple pathname,
a Root and a File, with some parsed attachment to it:
const Root = parsed`/`;
const File = Root`home``user``dir``
name: file;
ext: .txt;
`;
render(
<>
Root: <Root/> <br/>
File: <File/>
</>
);
Root: /
File: /home/user/file.txt
Utilities#
const Mount = parsed`foo``bar``baz`.mount`foo``bar`;
const From = parsed`foo``bar``baz`.from`foo``bar`;
const To = parsed`foo``bar``baz`.to`foo``bar`;
render(
<>
Mount: <Mount/> <br/>
From: <From/> <br/>
To: <To/>
</>
);
Mount: foo/bar/foo/bar/baz
From: baz
To: ..
React Recipies#
const VERSION = 2.1;
const API = parsed`api``v${VERSION}``user``${props => props.user}`;
const As = props => React.createElement('button', props, props.href);
render(
<API as={As} user={10}/>
)