Hello Everyone,
Iâm new to this framework and right now working on my first project. I would like to know if there is any way to exclude a specific path (example â/helloworldâ) from autoFacting.
What iâm trying to do is show some react component in â/helloworldâ page, but as I donât have this url in my wp iâm getting a 404 error in shell console. I looked for the documentation but only found a tiny-router setting âautoFetchâ, if I make that false the full autoFatch is turned off.
A help is highly appreciated.
Best regards
Hi @rezaurc
Welcome to the Frontity community. TBH Iâm not sure what youâre trying to do. Do you have a link to a repo that you can share with us so we can take a look at your code? Thanks.
Thanks for your response, Sorry I was not able to make my self clear.
All I wanted to do is to, use(show/display react component) a endpoint(/helloworld), that is not available on wp.
Regarding the repo itâs just fresh install(npx frontity create âŚ) as is without any change jsut go to /helloword, you will see 404(as expected).
All I want is use /helloword
Hope it make sense
Hi @rezaurc
OK, I think I understand. Letâs see if this what you need.
Iâm going to assume that youâre using mars-theme
. Import your component into the themeâs index.html
file.
import MyComponent from "./mycomponent"
then add <MyComponent when={state.router.link === '/helloworld/'} />
to the main <Switch>
statement.
<Main>
<Switch>
<Loading when={data.isFetching} />
<MyComponent when={state.router.link === '/helloworld/'} />
<List when={data.isArchive} />
<Post when={data.isPostType} />
<PageError when={data.isError} />
</Switch>
</Main>
Hope this helps. Let me know if this works for you.
Yes, That work as expected, but the issue is, itâs a 404 response, as I get the error in terminal on on browser network also itâs a 404, how can I make it 200 OK
Thanks again for your time
Hi @rezaurc
Iâm really sorry, but once again I donât think I understand you. Did your custom component appear in the browser when the URL was â/helloworld/â, or did you get the 404 component displayed?