Reputation: 664
I have a laravel app.
For pages with such routing: /admin/entity/
i want to use react components with react router to handle /admin/entity/:id
route.
If i use browserify to bundle all components in one file, i can't access any component to render it from outside since browserify wraps it to closure. Thus, i have few questions:
*.blade.php
file?Upvotes: 8
Views: 6210
Reputation: 2844
Here are my opinions:
/admin/entity
).<div>
) and should have something like a React Router configured so that it ignores /admin/entity
but renders /admin/entity/:id
. Your challenge is that any links that point to a different :id
URL should optimally be inside the React components, using Link
components. This will hook up your router automatically.Your routes will probably look like this:
<Route path="admin/entity/:id" handler={Entity} />
I believe that, when you run
the Router, if the browser's URL isn't in the expected format, React won't actually render anything.
Upvotes: 4